"%(a)s ... %(b)s" % {'a': foo, 'b': '%(b)s'}
D'Arcy J.M. Cain
darcy at vex.net
Wed Dec 8 05:56:34 EST 1999
Gerrit Holl <gerrit.holl at pobox.com> wrote:
> MAIL = '''From: someone <%(email)s>
> Subject: test
> this is feedback.py %(version)
> ''' % {'version': __version__}
> This raises a KeyError. I have to type:
> ... % {'version': __version__, 'email': '%(email)s'}
> This is ugly! Isn't there a better way to fill in just SOME of the %(...)s
> values in a string and leave the rest as is?
You mean like this?
MAIL = '''From: someone <%%(email)s>
Subject: test
this is feedback.py %(version)
''' % {'version': __version__}
--
D'Arcy J.M. Cain <darcy at vex.net> | Democracy is three wolves
http://www.vex.net/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
More information about the Python-list
mailing list