Hi, I have a dictionary, a string, and I'm creating another string, like this:
dict = {}
dict[beatles] = "need"
str = "love"
mystr = """All you %(dict[beatles])s is %(str)s""" % locals()
Why do I get
keyerror: 'dict[one]'?
Is there a way to reference the elements in a dictionary with locals()
or do I need to create a temp variable, like
need = dict[one]
mystr = """All you %(need)s is %(str)s"""
--
http://mail.python.org/mailman/listinfo/python-list
