[Tutor] How to leave literal %s in output of formatted string

Kristoffer Erlandsson krier115@student.liu.se
Thu May 15 11:10:02 2003


On Thu, May 15, 2003 at 10:28:42AM -0400, Jeff Kowalczyk wrote:
> I want to build a format string in code. How do I leave a
> literal %s in my string formatting output? I can't find any
> escape code for the % character.
> 
> (desired output)
> >>> VendorID = 'ACME'
> >>> s = '%s Download \%s' % VendorID
> 'Acme Download %s'
> 

>>> VendorID = 'ACME'
>>> s = '%s Download %%s' % VendorID
>>> s
'ACME Download %s'
>>> print s
ACME Download %s

Regards,
Kristoffer

-- 
Kristoffer Erlandsson
E-mail:  krier115@student.liu.se
ICQ#:    378225