diff options
author | Skip Montanaro <skip@pobox.com> | 2004-07-08 19:49:10 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2004-07-08 19:49:10 (GMT) |
commit | 2b2795ac6d20ad9171eb083a9e3bcf8eeaa4a889 (patch) | |
tree | 8ea83c75b00064e61e39fade9cfbe8746eda8259 /Doc/lib/libcsv.tex | |
parent | 1dffb120b733a45f9de3c1c4c2d10946ad6ea6d8 (diff) | |
download | cpython-2b2795ac6d20ad9171eb083a9e3bcf8eeaa4a889.zip cpython-2b2795ac6d20ad9171eb083a9e3bcf8eeaa4a889.tar.gz cpython-2b2795ac6d20ad9171eb083a9e3bcf8eeaa4a889.tar.bz2 |
show how easy it is to manipulate individual columns - from a request on
c.l.py
Diffstat (limited to 'Doc/lib/libcsv.tex')
-rw-r--r-- | Doc/lib/libcsv.tex | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/lib/libcsv.tex b/Doc/lib/libcsv.tex index f2dc912..5486cf1 100644 --- a/Doc/lib/libcsv.tex +++ b/Doc/lib/libcsv.tex @@ -319,6 +319,15 @@ for row in reader: print row \end{verbatim} +To print just the first and last columns of each row try + +\begin{verbatim} +import csv +reader = csv.reader(file("some.csv", "rb")) +for row in reader: + print row[0], row[-1] +\end{verbatim} + The corresponding simplest possible writing example is \begin{verbatim} |