答案 0 :(得分:0)
import csv
l = ['test1', 'test2', 'test3']
with open('eggs.csv', 'wb', newline='') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=',',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
spamwriter.writerow(l)
您最好不要将list用作变量名,因为它会与python的内部列表函数冲突。