ignoring some placeholders in string formatting
Steven D'Aprano
steven at REMOVE.THIS.cybersource.com.au
Wed Feb 10 21:11:38 EST 2010
On Thu, 11 Feb 2010 14:25:10 +1300, Michal Ludvig wrote:
> Hi all,
>
> when I've got a string, say:
>
> URL="http://xyz/blah?session=%(session)s&message=%(message)s"
>
> is it possible to fill in only 'session' and leave "%(message)s" as is
> when it isn't present in the values dict?
No, but instead see string templates:
http://docs.python.org/library/string.html#template-strings
--
Steven
More information about the Python-list
mailing list