How do I escape slashes the string formatting operator? (or: why is it behaving this way?)

Dustan DustanGroups at gmail.com
Thu May 7 01:41:25 CEST 2009


Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 'HELP!%(xyz)/' % {'xyz':' PLEASE! '}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unsupported format character '/' (0x2f) at index 11
>>>

It doesn't like the forward slash after the closed parentheses. I
don't know what it is expecting, but I need that slash there
(obviously this is a simplified example).

All help appreciated.



More information about the Python-list mailing list