Dictreader Error: Expected String Or Unicode Object, List Found
I am trying to read a google sheet document with permissions like this: opener = urllib2.build_opener() opener.addheaders = [('Accept-Charset', 'utf-8')] response = ope
Solution 1:
As far as I understand, unicodecsv returns a list, in your case csv_records
.
This is taken from the github README:
>>>import unicodecsv as csv>>>from io import BytesIO>>>f = BytesIO()>>>w = csv.writer(f, encoding='utf-8')>>>_ = w.writerow((u'é', u'ñ'))>>>_ = f.seek(0)>>>r = csv.reader(f, encoding='utf-8')>>>next(r) == [u'é', u'ñ']
True
See the comparison at the end.
You put this returned list into a csv.DictReader()
, which is not necessary, since the result already is within csv_records
.
Print out this variable, see what is inside.
Post a Comment for "Dictreader Error: Expected String Or Unicode Object, List Found"