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
Post a Comment