Re: ignoring some placeholders in string formatting

2010-02-10 Thread MRAB
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? For example: URL % { 'session' : 123 } raises KeyError becau

Re: ignoring some placeholders in string formatting

2010-02-10 Thread Steven D'Aprano
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 i

Re: ignoring some placeholders in string formatting

2010-02-10 Thread Tim Chase
Michal Ludvig wrote: 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? For example: URL % { 'session' : 123 } raises KeyError because of missing 'message' in the dict. I