The Boolean has_key() and the in and not in operators are Boolean, returning True if a dictionary has that key and False otherwise. : has_key « Dictionary « Python Tutorial






dict1 = {'name': 'earth', 'port': 80}
print 'server' in dict1
print 'name' in dict1 
print dict1['name']








8.11.has_key
8.11.1.The has_key method checks whether a dictionary has a given key.
8.11.2.The Boolean has_key() and the in and not in operators are Boolean, returning True if a dictionary has that key and False otherwise.