String formatting with two dictionaries?

Ralph Corderoy ralph at
Wed Oct 10 11:06:12 CEST 2001


> > s = ("%(foo)s %%(spam)s" % d1) % d2
> > 
> > use two "%" for variables that are in the second dict.
> Neat.  Note of course that this requires everything which has only a
> single % to be in the first dictionary, and everything with %% to be
> in the second.  Might be what was wanted... or maybe the OP won't
> like that either...

Doesn't that cause problems if the substitution for %(foo)s contains a
percent sign?


More information about the Python-list mailing list