[Python-checkins] r42418 - python/trunk/Doc/lib/libcsv.tex

thomas.wouters python-checkins at python.org
Thu Feb 16 15:57:05 CET 2006


Author: thomas.wouters
Date: Thu Feb 16 15:57:05 2006
New Revision: 42418
Modified:
 python/trunk/Doc/lib/libcsv.tex
Log:
Fix broken example of csv.reader use (it returns an iterator, which isn't
indexable) by using the same 'for' construct as all other examples. (Also
emphasizes that reading from a random iterable is no different than reading
from a file.)
Modified: python/trunk/Doc/lib/libcsv.tex
==============================================================================
--- python/trunk/Doc/lib/libcsv.tex	(original)
+++ python/trunk/Doc/lib/libcsv.tex	Thu Feb 16 15:57:05 2006
@@ -421,7 +421,8 @@
 
 \begin{verbatim}
 import csv
-print csv.reader(['one,two,three'])[0]
+for row in csv.reader(['one,two,three']):
+ print row
 \end{verbatim}
 
 The \module{csv} module doesn't directly support reading and writing


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /