csv reading fields
Nick Smallbone
nick at nick8325.freeserve.co.uk
Thu Jul 8 15:06:48 EDT 2004
More information about the Python-list mailing list
Thu Jul 8 15:06:48 EDT 2004
- Previous message (by thread): [ANN] libgmail 0.0.3 -- Gmail access via Python
- Next message (by thread): csv reading fields
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Mark F" <mfaine-usenet at knology.net> wrote in message news:40ed95dd$1_6 at corp.newsgroups.com... > To say I'm a python newbie would be an understatement but I think it is a > language worth learning and would make a great replacement for perl in our > shop. > > I'm trying to read a CSV file using the python csv module but I can't seem > to determine how to use the API, it seems to me that I can do nothing more > than opening the file and printing the lines of the file. I can do that > without the CSV module. I need to know how to address individual fields. > > Something like this: (not actual python code) > > > import csv > reader = csv.reader(file("some.csv")) > for row in reader: > print row.field(3) or import csv > reader = csv.reader(file("some.csv")) > if reader.field(2,1) == "test.zip": print "test.zip exists" > Thanks,-Mark > How about: import csv reader = csv.reader(file("some.csv")) for row in reader: print row[3] Nick
- Previous message (by thread): [ANN] libgmail 0.0.3 -- Gmail access via Python
- Next message (by thread): csv reading fields
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list