I'm trying to write some data in csv file using the binary mode. My data is a list of lists which looks like this:
data= [[None, u'https://aaa.com/p/cat.do?tags=|5555|4444|8888&zzz;A=3', u'00 .00.00.000, 00.00.00.000', u'25359725', u'2018-03-06 18:01:18', u'DC01F54GH8D.aa201', None, 1814498434, 765651, u'2018-03-12 18:01:18', 168, 0, u'2018-03-12 18: 32:08.428032'], [None, u'https://aaa.com/p/cat.do?tags=|5555|4444|8888&zzz;A=\x80\x99s+Day+', u'00.00.00.000, 00.00.00.000', u'10707456', u'2018-03-06 18:01:02', u'76FD86AA.abd', None, 1814498440, 760960, u'2018-03-12 18:01:02', 168, 0, u'2018-03-12 18:32:08.805207']]
filename="table.csv"
with open(filename, "wb") as f:
writer = csv.writer(f)
writer.writerows(data)
but this raises the following error:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 152-153: ordinal not in range(128)
I've spent a lot of time trying to solve this problem without success. Can you help me with this please?
I'm using python 2.7
.
Thanks in advance
EDIT: I've added the example that is causing the problem + I know that there is a similar post but it only deals with a single string, here I'd like to know how to deal with list of lists.