Mega Code Archive

 
Categories / Python Tutorial / Dictionary
 

Using the dictionary name will cause an iterator over that dictionary

dict2 = {'name': 'earth', 'port': 80} for key in dict2:      print 'key=%s, value=%s' % (key, dict2[key])