diff options
author | Georg Brandl <georg@python.org> | 2006-03-07 13:47:22 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-03-07 13:47:22 (GMT) |
commit | 58780d2642a3a82004c7f2c205b78450b12f177a (patch) | |
tree | 2beb7c41160c2a741911f313bdf1923f12221981 /Doc/lib/libcsv.tex | |
parent | 47f003d326f4e30a17cf9d91e384e98e7367533a (diff) | |
download | cpython-58780d2642a3a82004c7f2c205b78450b12f177a.zip cpython-58780d2642a3a82004c7f2c205b78450b12f177a.tar.gz cpython-58780d2642a3a82004c7f2c205b78450b12f177a.tar.bz2 |
Bug #1440831: fix csv UnicodeWriter example
Diffstat (limited to 'Doc/lib/libcsv.tex')
-rw-r--r-- | Doc/lib/libcsv.tex | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/lib/libcsv.tex b/Doc/lib/libcsv.tex index 22cfda5..ba0df4f 100644 --- a/Doc/lib/libcsv.tex +++ b/Doc/lib/libcsv.tex @@ -428,7 +428,7 @@ for row in csv.reader(['one,two,three']): The \module{csv} module doesn't directly support reading and writing Unicode, but it is 8-bit clean save for some problems with \ASCII{} NUL characters, so you can write classes that handle the encoding and decoding -for you as long as you avoid encodings like utf-16 that use NULs. +for you as long as you avoid encodings like utf-16 that use NULs: \begin{verbatim} import csv @@ -451,7 +451,7 @@ class UnicodeWriter: self.encoding = encoding def writerow(self, row): - self.writer.writerow([s.encode("utf-8") for s in row]) + self.writer.writerow([s.encode(self.encoding) for s in row]) def writerows(self, rows): for row in rows: |