> >>> P=P.replace('\\','\\\\').replace(']','\\]') # escape both of them.
re.escape() does this w/o any assumptions by your code about the regex implementation. -- http://mail.python.org/mailman/listinfo/python-list
> >>> P=P.replace('\\','\\\\').replace(']','\\]') # escape both of them.
re.escape() does this w/o any assumptions by your code about the regex implementation. -- http://mail.python.org/mailman/listinfo/python-list