From: Skip Montanaro Date: Thu, 8 Jul 2004 19:49:10 +0000 (+0000) Subject: show how easy it is to manipulate individual columns - from a request on X-Git-Tag: v2.4a2~369 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b2795ac6d20ad9171eb083a9e3bcf8eeaa4a889;p=python show how easy it is to manipulate individual columns - from a request on c.l.py --- diff --git a/Doc/lib/libcsv.tex b/Doc/lib/libcsv.tex index f2dc912bdc..5486cf14a2 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}