I have a list xline. It is initialized and then appended. But I am getting an error when I run?
xline = []
---#append
----
print (''.join(xline)) # Convert list into string
Run time error
print (''.join(xline)) # Convert list into string
TypeError: sequence item 0: expected string, int found
What is wrong?
You can use str() to transform each element:
print ''.join([str(x) for x in xline])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With