mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
show how easy it is to manipulate individual columns - from a request on
c.l.py
This commit is contained in:
parent
1dffb120b7
commit
2b2795ac6d
1 changed files with 9 additions and 0 deletions
|
@ -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}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue