Mega Code Archive

 
Categories / Python Tutorial / Dictionary
 

The Boolean has_key() and the in and not in operators are Boolean, returning True if a dictionary has that key and False otherw

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