Convert Python list to column in CSV

I have a list of values ​​(v1, v2, v3) and I want to write them to a column named VALUES in csv. I use csvreader and csvwriter to get as far as I know. I just figured out how to write them in lines using csvwriter.writerow.

+4
source share
1 answer

Looks like you tried:

values = [1, 2, 3, 4, 5] thecsv = csv.writer(open("your.csv", 'wb')) thecsv.writerow(values) 

Maybe you should try:

 values = [1, 2, 3, 4, 5] thecsv = csv.writer(open("your.csv", 'wb')) for value in values: thecsv.writerow(value) 
+3
source

All Articles