While I python code that write and read to csv file utf8 string
import csv
test1='ab"cc"dd'.encode('utf8')
test2='bbb'.encode('utf8')
csv_file = open('test.csv','w')
writer= csv.writer(csv_file)
writer.writerow([test1,test2])
csv_file.close()
with open('test.csv', newline='') as csvfile:
spamreader = csv.reader(csvfile, delimiter=',', quotechar='"')
print(spamreader)
for row in spamreader:
print(', '.join(row))
The problem is that when I read I got b'ab"cc"dd', b'bbb' instead of ab"cc"dd,bbb
How can I decode that string (I must put utf8 into csv) ?