Mercurial > cpython-lru_cache-weakref
diff Doc/lib/libcsv.tex @ 36870:455672a8f877 legacy-trunk
Bug #1440831: fix csv UnicodeWriter example
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Tue, 07 Mar 2006 13:47:22 +0000 |
| parents | 2297b270fcf6 |
| children | f731859e9b3b 49dbedfb1d74 |
line wrap: on
line diff
--- a/Doc/lib/libcsv.tex Tue Mar 07 13:38:14 2006 +0000 +++ b/Doc/lib/libcsv.tex Tue Mar 07 13:47:22 2006 +0000 @@ -428,7 +428,7 @@ 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 @@ 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:
