using csv dictreader in python

Siva Subramanian neuphyte at gmail.com
Wed Nov 4 08:55:16 CET 2009


Hello all,

I am now trying to access the csv file using dictreader.

import csv

r25  = csv.DictReader(open('Report_
25', 'rb'), delimiter=',')

rownum = 1
for row in r25:
    # Save header row.
    if rownum == 0:
        header = row
    else:
        colnum = 0
        for col in row:

This only gets me the following output

{'FieldName1': '4', 'FieldName2': '0.00', 'FieldName3':
'4001433', 'FieldName4': '759'}

1. How do i access the 4, 0.00, ... the values ?
2. How do i compare it with another csv file ?

Thanks in advance
Siva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091104/d2e92903/attachment.html>


More information about the Python-list mailing list