#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 Py33

dick = {'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'

-- 
Jim Mooney

Texting a program as he drove, John inadvertently dereferenced a null
pointer, and a huge crash ensued.

The good thing about crocodile farts is few of us feel the need to get
that close to a crocodile.
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to