dict problem
Roberto Bonvallet
Roberto.Bonvallet at cern.ch
Wed Oct 25 05:02:01 EDT 2006
Alistair King wrote:
> Hi,
>
> ive been trying to update a dictionary containing a molecular formula, but seem to be getting this error:
>
>
> Traceback (most recent call last):
> File "DS1excessH2O.py", line 242, in ?
> updateDS1v(FCas, C, XDS)
> NameError: name 'C' is not defined
>
> dictionary is:
>
> DS1v = {'C': 6, 'H': 10, 'O': 5}
Try DS1v['C'] instead of DS1v[C].
Cheers,
--
Roberto Bonvallet
More information about the Python-list
mailing list