What's the cleanest way to test if a dictionary contains a key?
x = {'a' : 1, 'b' : 2}
if (x.contains_key('a')):
....
'a' in x
and a quick search reveals some nice information about it: http://docs.python.org/3/tutorial/datastructures.html#dictionaries
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With