How to convert list to a string?

0 like 0 dislike
7 views
Need to translate a list into a string.
for row in data_body: print(row) data = ','.join(row)


However, I get the following error. Can't understand why:
[None, u'1516482864.000000', 627, 0, u'9227943', 41, 60.0, u 'transaction', u'+345348880', u'5000.00', u'345188435', 472, 1463, u'2018-01-20 21:12:19.019598', u 6be2d345dd43af6fc23', 6225064, u'222222222'] Traceback (most recent call last): File "app.py", line 72, in data = ','.join(row) TypeError: sequence item 0: expected string, NoneType found
by | 7 views

1 Answer

0 like 0 dislike
data = ','.join(str(i) for i in row)

if None should be removed
data = ','.join(str(i) for i in row if i is not None)
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
asked Jun 10, 2019 by alekskondr
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
asked May 21, 2019 by vldanch
110,608 questions
257,186 answers
0 comments
33,718 users