Format strings that contain '%'
rick_muller@yahoo.com
rpmuller at gmail.com
Tue Mar 8 11:38:57 EST 2005
I'm trying to do something along the lines of
>>> print '%temp %d' % 1
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: unsupported format character 't' (0x74) at index 1
although, obviously I can't do this, since python thinks that the '%t'
is a format string.
I've tried obvious permutations like
>>> print '\%temp %d' % 1
which also doesn't work.
For (template) reasons, I can't do
>>> print '%s %d' % ('%temp',1)
Will anything else work here?
More information about the Python-list
mailing list