Mega Code Archive

 
Categories / Python Tutorial / Dictionary
 

Iteritems method returns an iterator instead of a list

d = {'title': 'Python Web Site', 'url': 'http://www.python.org', 'spam': 0} it = d.iteritems() print it print list(it) # Convert the iterator to a list