On 2007-07-05, Captain Poutine <[EMAIL PROTECTED]> wrote:
> I'm simply trying to read a CSV into a dictionary.
>
> (if it matters, it's ZIP codes and time zones, i.e.,
> 35983,CT
> 39161,CT
> 47240,EST
>
>
>
> Apparently the way to do this is:
>
> import csv
>
> dictZipZones = {}
>
> reader = csv.reader(open("some.csv", "rb"))
> for row in reader:
>      # Add the row to the dictionary

In addition to Chris's answer, the csv module can read and write
dictionaries directly. Look up csv.DictReader and csv.DictWriter.

-- 
Neil Cerutti
In my prime I could have handled Michael Jordan.  Of course, he would be only
12 years old. --Jerry Sloan
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to