sre_constants.error: bogus escape

Oliver Rutherfurd oliver at rutherfurd.net
Tue Nov 5 15:16:16 EST 2002


----- Original Message ----- 
From: "Bradley D. Larson" <blarson at crary.com>
To: "python" <python-list at python.org>
Sent: Tuesday, November 05, 2002 1:25 PM
Subject: sre_constants.error: bogus escape


> What is the best method of changing a \ character to something else

Try using the 'replace' method for a string:

>>> s = 'a\\b\\c'
>>> s = s.replace('\\','/')
>>> print s
a/b/c

HTH,
-Ollie




More information about the Python-list mailing list