doubling slashes in a string

Remco Gerlich scarblac at pino.selwerd.nl
Mon Oct 9 09:35:34 EDT 2000


Joshua Muskovitz <josh at open.com> wrote in comp.lang.python:
> Bzzt.  Thanks, but the point was to *double* the backslash.  The intended
> result is not a legal pathname.  In fact, it is intended to go into yet
> another interpreted language, and thus the backslashes needed to be escaped
> (by doubling them).  The original string was a valid path.  Interestingly,
> this is meant to work on a cross platform basis, and yet, only backslashes
> need to be doubled, since they are the only special character needing to be
> escaped.  On a *nix box, the doubling is not necessary.  Thus, the
> split/join or replace is what is needed.

I don't know if you can use it here, but slashes work just as well as
backslashes under Windows.

Remco Gerlich



More information about the Python-list mailing list