summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-02-16 14:57:05 (GMT)
committerThomas Wouters <thomas@python.org>2006-02-16 14:57:05 (GMT)
commitbbdf6078f689aca2c8443db652a93d253698d040 (patch)
treec606611998a182ac65a5ef8b5b99d2c6b6b52d17 /Doc
parent41290685f9d5c7aed544bd5db90914ab82f9d213 (diff)
downloadcpython-bbdf6078f689aca2c8443db652a93d253698d040.zip
cpython-bbdf6078f689aca2c8443db652a93d253698d040.tar.gz
cpython-bbdf6078f689aca2c8443db652a93d253698d040.tar.bz2
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.)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libcsv.tex3
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/lib/libcsv.tex b/Doc/lib/libcsv.tex
index 86d1025..22cfda5 100644
--- a/Doc/lib/libcsv.tex
+++ b/Doc/lib/libcsv.tex
@@ -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