csv reading fields

Mark F mfaine-usenet at knology.net
Thu Jul 8 20:44:22 CEST 2004

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

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"

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 100,000 Newsgroups - 19 Different Servers! =-----

More information about the Python-list mailing list