Fix broken example of csv.reader use (it returns an iterator, which isn't
authorThomas Wouters <thomas@python.org>
Thu, 16 Feb 2006 14:57:05 +0000 (14:57 +0000)
committerThomas Wouters <thomas@python.org>
Thu, 16 Feb 2006 14:57:05 +0000 (14:57 +0000)
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.)

Doc/lib/libcsv.tex

index 86d102551e8dc91143140f1830c6f90f67fe3d36..22cfda5e444b9ddb74fe6fab394396f1e3a92cac 100644 (file)
@@ -421,7 +421,8 @@ easily be done:
 
 \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