What’s the cleanest way to test if a dictionary contains a key?

x = {'a' : 1, 'b' : 2}
if (x.contains_key('a')):
    ....

1 Answer
1

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *