locals() and dictionaries
Kent Johnson
kent at kentsjohnson.com
Thu Feb 2 17:45:27 EST 2006
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 good at this one :), so my question
> stands:
>
> is it possible to access the individual members of a dictionary using %
> locals() when creating a string?
You might want to use a more powerful templating engine, for example
http://cheetahtemplate.org/ and probably many others.
Kent
More information about the Python-list
mailing list