How to test if a dictionary contains a specific key? [duplicate]

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

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

Solution 1:

'a' in x

and a quick search reveals some nice information about it: http://docs.python.org/3/tutorial/datastructures.html#dictionaries