How to convert a list to a csv in python -


i have list: ['1','2','3'] , want convert 1,2,3 i.e. no brackets or quotation marks.

if want generate canonical csv file, use csv module.


example docs:

>>> import csv >>> spamwriter = csv.writer(open('eggs.csv', 'wb'), delimiter=' ', ...                         quotechar='|', quoting=csv.quote_minimal) >>> spamwriter.writerow(['spam'] * 5 + ['baked beans']) >>> spamwriter.writerow(['spam', 'lovely spam', 'wonderful spam']) 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -