Mega Code Archive

 
Categories / Python Tutorial / Dictionary
 

Len() returns the total number of items, that is, key-value pairs

dict2 = {'name': 'earth', 'port': 80} print dict2 print len(dict2)