On 04/27/2013 10:21 PM, Jim Mooney wrote:
#Changing a dictionary into a 2-tuple list with the items method works, as per the #first example. But using iteritems returns an error - using Py33dick = {'villain': 'Roderigo', 'hero': 'Othello', 'friend': 'Cassio', 'beauty':'Desdemona'} dickList = dick.items() for role, name in dickList: print(role, name) #The above works, but using iteritems() in place of items doesn't dickList2 = dick.iteritems() for role, name in dickList2: print(role, name) #error: builtins.AttributeError: 'dict' object has no attribute 'iteritems'
In py3.x, iteritems was replaced by .items() -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
