York wrote:

> I have two backslash - a. and I want to replace them with one backslash, 
> but I failed:
> 
>  >>> import re
>  >>> a = '\\\\'
>  >>> re.sub(r'\\\\', '\\', '\\\\')

John has already sorted the RE-specific part of the problem, but it's 
also worth noting that using the RE engine for literal strings is over-
kill; an ordinary replace is easier to use and faster:

     >>> a = "\\\\"
     >>> a.replace("\\\\", "\\")
     '\\'

</F>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to