JerryB wrote:
> Rocco:
> thanks for your response. The examples were just made up. I don't
> normally use 'dict' and 'str'.
> I know I can create a dictionary with the variables I want, etc. My
> question is not how to solve the problem, or how to come up with a
> work-around (I'm getting pretty go
JerryB <[EMAIL PROTECTED]> wrote:
...
> is it possible to access the individual members of a dictionary using %
> locals() when creating a string?
Not by using the built-in locals(); you'd have to override locals to
mean someting different (not recommended).
Alex
--
http://mail.python.org/ma
Rocco:
thanks for your response. The examples were just made up. I don't
normally use 'dict' and 'str'.
I know I can create a dictionary with the variables I want, etc. My
question is not how to solve the problem, or how to come up with a
work-around (I'm getting pretty good at this one :), so my q
JerryB wrote:
> 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 th
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()
o