I am having problems with the DictWriter and non-ascii characters. A short version of my problem:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
im
The object you obtain with codecs.open
wants a unicode string in its write
method -- that's the whole point. csv.DictWriter
of course is calling that method with a utf8-encoded byte string instead, whence the exception.
Change f
's creation to f = open("test.csv", 'wb')
(taking codecs
out of the picture) and things should work just fine.