Escaping slashes (double backslash plague)
Aloysio Figueiredo
xpythonist at yahoo.com.br
Mon Jan 19 07:43:01 EST 2004
I need to replace every ocurrence of '/' in s by '\/'
in order to create a file named s. My first attempt
was:
s = '\/'.join(s.split('/'))
but it doesn't work:
>>> s = 'a/b'
>>> s = '\/'.join(s.split('/'))
>>> s
'a\\/b'
>>> repr(s)
"'a\\\\/b'"
>>>
'\/'.join() escapes the backslashes and I don't know
why.
Any help?
Aloysio Figueiredo
______________________________________________________________________
Yahoo! GeoCities: a maneira mais fácil de criar seu web site grátis!
http://br.geocities.yahoo.com/
More information about the Python-list
mailing list