diff Doc/lib/libcsv.tex @ 32553:c099aa767952 legacy-trunk

show how easy it is to manipulate individual columns - from a request on c.l.py
author Skip Montanaro <skip@pobox.com>
date Thu, 08 Jul 2004 19:49:10 +0000
parents 3c796413f05e
children 4e2c66021bf3
line wrap: on
line diff
--- a/Doc/lib/libcsv.tex	Thu Jul 08 19:13:55 2004 +0000
+++ b/Doc/lib/libcsv.tex	Thu Jul 08 19:49:10 2004 +0000
@@ -319,6 +319,15 @@
     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}