I write data from a loop to a csv-file.
Expected outcome: Every iteration should write data in a new column.
Actually, it overwrites the data of the last iteration. How could I add a new column for every iteration?
def keywordsToCsv(filename, single_phrases):
path = 'keywords/keywords.csv'
with open(path, 'w', encoding='utf-8') as csvfile:
filewriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
filewriter.writerow([filename])
for phrase in single_phrases:
filewriter.writerow([phrase])