Partial string formatting?
Gonçalo Rodrigues
op73418 at mail.telepac.pt
Tue Jan 21 11:18:55 EST 2003
Hi,
Is there a simple way to do partial string formatting short of using
RE's, e.g
<string> % <mapping>
where if a key is not present in <mapping> it just leaves it untouched?
I thought of subclassing dict to hand out a default item, which it would
just be the requested key wrapped in %()s. Of course this only works if
the format code is s but not with other format codes or even more
complicated options.
Thanks in advance,
G. Rodrigues
More information about the Python-list
mailing list