I am working on an openstreetmap project and have the following code
class UnicodeDictWriter(csv.DictWriter, object):
"""Extend csv.DictWriter to handle Unicode input"""
def writerow(self, row):
super(UnicodeDictWriter, self).writerow({
k: (v.encode('utf-8') if isinstance(v, unicode) else v) for k, v in row.items()})
def writerows(self, rows):
for row in rows:
self.writerow(row)
It throws me the error message name unicode is not defined, research did not give a clue for solving it. How do I modify the code to a working one? (Please be patient, I am still learning)