using csv dictreader in python

Johann Spies jspies at sun.ac.za
Wed Nov 4 11:36:01 CET 2009


On Wed, Nov 04, 2009 at 01:25:16PM +0530, Siva Subramanian wrote:

> 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 ?

>>> a= {'FieldName1': '4', 'FieldName2': '0.00', 'FieldName3': '4001433', 'FieldName4': '759'}
>>> a
{'FieldName4': '759', 'FieldName1': '4', 'FieldName3': '4001433', 'FieldName2': '0.00'}
>>> a['FieldName3']
'4001433'

> 2. How do i compare it with another csv file ?

If you have the values in one file, get the values in the other one
and then compare.  I am not sure I understand what is the problem here.

Regards
Johann
-- 
Johann Spies          Telefoon: 021-808 4599
Informasietegnologie, Universiteit van Stellenbosch

     "Train up a child in the way he should go: and when he
      is old, he will not depart from it."   Proverbs 22:6 



More information about the Python-list mailing list