[Python-checkins] r42887 - python/trunk/Doc/lib/libcsv.tex
georg.brandl
python-checkins at python.org
Tue Mar 7 14:47:23 CET 2006
Author: georg.brandl
Date: Tue Mar 7 14:47:22 2006
New Revision: 42887
Modified:
python/trunk/Doc/lib/libcsv.tex
Log:
Bug #1440831: fix csv UnicodeWriter example
Modified: python/trunk/Doc/lib/libcsv.tex
==============================================================================
--- python/trunk/Doc/lib/libcsv.tex (original)
+++ python/trunk/Doc/lib/libcsv.tex Tue Mar 7 14:47:22 2006
@@ -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:
More information about the Python-checkins
mailing list