diff Doc/lib/libcsv.tex @ 36525:2297b270fcf6 legacy-trunk

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.)
author Thomas Wouters <thomas@python.org>
date Thu, 16 Feb 2006 14:57:05 +0000
parents aa707041505d
children 455672a8f877
line wrap: on
line diff
--- a/Doc/lib/libcsv.tex	Thu Feb 16 14:56:14 2006 +0000
+++ b/Doc/lib/libcsv.tex	Thu Feb 16 14:57:05 2006 +0000
@@ -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