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 TUTORIALS


PYTHON TUTORIALS » Dictionary » Has_key »

 

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


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



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Dictionary
» Has_key