myDict.get(fldType, None)

this will output the value from myDict if the key exists, if not it will

return None

Thanks this looks perfect - did not know dict.get()

You may also want to consider {}.setdefault -- that would collect the fldType entries not defined.

>>> a = {'a':1,'b':2}
>>> a.setdefault('a','?')
1
>>> a.setdefault('c','?')
'?'
>>> a
{'a': 1, 'c': '?', 'b': 2}

Emile

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to