Mega Code Archive

 
Categories / Python Tutorial / Dictionary
 

The has_key method checks whether a dictionary has a given key

d = {'name':'Joe'} print d.has_key('name') d['name'] = 'Eric' print d.has_key('name')