Reputation: 4859
I want to add python list to a csv file with this code:
RESULTS = ['aa','bb','cc']
resultFile = open("c:\\temp\\output4.csv",'wb')
wr = csv.writer(resultFile, dialect='excel')
wr.writerows(RESULTS)
resultFile.flush()
but this code overwrites my previous file. how to enable appending?
Unfortunately I can't find any solution to do this using this way.
Upvotes: 0
Views: 113
Reputation: 1121186
Open the file in append mode instead:
resultFile = open("c:\\temp\\output4.csv", 'ab')
Upvotes: 3