how to get all the "variables" of a string formating?
GHUM
haraldarminmassa at gmail.com
Wed Dec 6 12:41:36 EST 2006
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