NameError when assigning dictionary values
lewst
lewst at yahoo.com
Sun Apr 2 16:33:38 EDT 2000
This simple problem is driving my crazy. I can't figure out why I get
a NameError with this program.
# add each key-value pair to the dictionary and
# then for each value, create an empty list.
mydict = {}
for key,value in [ (".", "one"), ("+", "two") ]:
mydict[key] = value
value = []
print mydict
print one,two
Whe I run this I get "NameError: one". Why aren't my 2 empty lists
named "one" and "two" being created?
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
More information about the Python-list
mailing list