sre_constants.error: bogus escape

Bradley D. Larson blarson at crary.com
Tue Nov 5 14:25:19 EST 2002


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

I'm trying to use re....

        pat = re.compile('\\');  ts = pat.sub(':',ts)

which produces....

  File "C:\PYTHON21\Lib\sre.py", line 90, in compile
    return _compile(pattern, flags)
  File "C:\PYTHON21\Lib\sre.py", line 136, in _compile
    raise error, v # invalid expression
sre_constants.error: bogus escape


-------------- next part --------------
A non-text attachment was scrubbed...
Name: blarson.vcf
Type: text/x-vcard
Size: 400 bytes
Desc: Card for Bradley D. Larson
URL: <http://mail.python.org/pipermail/python-list/attachments/20021105/49270c17/attachment.vcf>


More information about the Python-list mailing list