more on unescaping escapes

bvdp bob at mellowood.ca
Mon Feb 23 19:46:34 EST 2009


Chris Rebert wrote:
> On Mon, Feb 23, 2009 at 4:26 PM, bvdp <bob at mellowood.ca> wrote:
> [problem with Python and Windows paths using backslashes]
> 
> Is there any particular reason you can't just internally use regular
> forward-slashes for the paths? They work in Windows from Python in
> nearly all cases and you can easily interconvert using os.pathsep if
> you want the path to be pretty when you show it to (or get it from)
> the user or whatever.
> 
> Cheers,
> Chris
> 

Just because I never really thought too much about it :) I'm doing my 
work on a linux box and my user is on windows ... and he's used to using 
'\' ... but, you are absolutely right! Just use '/' on both systems and 
be done with it. Of course I still need to use \x20 for spaces, but that 
is easy.

Thanks for the suggestion!



More information about the Python-list mailing list