[Tutor] double backslash in Windows paths

tpc at csua.berkeley.edu tpc at csua.berkeley.edu
Fri Apr 30 19:21:34 EDT 2004

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.

More information about the Tutor mailing list