I have a list of strings in python.
header_list = ['column_1', 'column_2', 'column_3']
I want to replace the header row of a cvs file text.csv
based on header_list
such that the header will look like this;
column_1, column_2, column_3
I am using python v3.6
EDIT: Here is the code that I came up with.
import csv
with open('text.csv', 'wb') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(header_list)
I get the error;
TypeError: a bytes-like object is required, not 'str'