I am trying to write an array like this into csv column
x= ['[email protected]','[email protected]']
how i can write the same array into one csv column like this
[email protected],[email protected]
Thanks
I am trying to write an array like this into csv column
x= ['[email protected]','[email protected]']
how i can write the same array into one csv column like this
[email protected],[email protected]
Thanks
This will work for what you're trying to do.
import csv
x = ['[email protected]','[email protected]']
csvOpen = open("yourCSV.csv", 'wb')
out_csv = csv.writer(csvOpen)
out_csv.writerow(x)
csvOpen.close()
row = ['col1', ','.join(x), 'col3']; out_csv.writerow(row).It really depends on what is importing your CSV. There is no official standard for CSV but RFC 4180 provides a spec that a lot of people implement. If you follow that, you can simply surround your field in quotes. So in python, this would be:
str.format('"{}"',str.join(",",x))
csv module is already in the standard library.