how to get all the "variables" of a string formating?
dakman at gmail.com
dakman at gmail.com
Wed Dec 6 13:58:56 EST 2006
"Is there an easy (i.e.: no regex) way to do get the names of all
parameters? "
...regexp is the easy way :D
GHUM wrote:
> imagine:
>
>
> template=""" Hello %(name)s, how are you %(action)s"""
>
>
> we can use it to do things like:
>
> print template % dict (name="Guido", action="indenting")
>
>
> Is there an easy (i.e.: no regex) way to do get the names of all
> parameters?
>
> get_parameters(template) should return ["name", "action"]
>
>
> Python has to do this somewhere internally..... how to access this
> knowledge?
>
> Harald
More information about the Python-list
mailing list