Get dictionary-keys used to format a string

Michael Hudson mwh21 at cam.ac.uk
Thu Mar 2 06:46:47 EST 2000


Michael =?iso-8859-1?Q?Str=F6der?= <michael.stroeder at inka.de> writes:

> Hence the example from the Python docs:
> 
> '%(language)s has %(count)03d quote types.' % vars()
> 
> I would like to extract the keys in the formatting string to a list.
> Well I can parse it myself but is there a built-in function to
> extract a list/tuple of the dictionary keys, e.g.
> ['language','count'] in this case?
> 

Don't think so, sorry.

Cheers,
M.

-- 
very few people approach me in real life and insist on proving they are
drooling idiots.                         -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list