[Tutor] Re: double backslash in Windows paths

Andrei project5 at redrival.net
Sat May 1 05:28:15 EDT 2004

<tpc at csua.berkeley.edu> wrote on Fri, 30 Apr 2004 16:21:34 -0700 (PDT):

> hi everybody, what do you guys use to convert a Windows path, with single
> backslash, to double backslash ?  I ask this because I've been using
> os.path.normpath, and it leaves A LOT to be desired.  If you pass it a
> path, and say some directory in the path starts with a number,
> os.path.normpath WILL mangle the path by inserting a '\x{hex value}'
> instead of the desired behavior, '\\{dirname}'.  Then you have to go back
> and clean up and add in the extra backslash in the string before using it.

I use forward slashes in paths. Works in Windows too from Python and you
don't have to escape them.



Real contact info (decode with rot13):
cebwrpg5 at jnanqbb.ay. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq
gur yvfg, fb gurer'f ab arrq gb PP.

More information about the Tutor mailing list