What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread W. eWatson
I'm sure that \\ is used in some way for paths in Win Python, but I have not found anything after quite a search. I even have a six page pdf on a file tutorial. Nothing. Two books. Nothing. When I try to open a file along do I need, for example, Events\\record\\year\\today? Are paths like,

Re: What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread Alf P. Steinbach
* W. eWatson: I'm sure that \\ is used in some way for paths in Win Python, but I have not found anything after quite a search. I even have a six page pdf on a file tutorial. Nothing. Two books. Nothing. When I try to open a file along do I need, for example, Events\\record\\year\\today? Are

Re: What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread Steve Holden
W. eWatson wrote: I'm sure that \\ is used in some way for paths in Win Python, but I have not found anything after quite a search. I even have a six page pdf on a file tutorial. Nothing. Two books. Nothing. When I try to open a file along do I need, for example, Events\\record\\year\\today?

Re: What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread W. eWatson
Alf P. Steinbach wrote: * W. eWatson: I'm sure that \\ is used in some way for paths in Win Python, but I have not found anything after quite a search. I even have a six page pdf on a file tutorial. Nothing. Two books. Nothing. When I try to open a file along do I need, for example,

Re: What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread Tim Chase
Alf P. Steinbach wrote: that you cannot write e.g. c:\windows\system32, but must write something like c:\\windows\\system32 (try to print that string), or, since Windows handles forward slashes as well, you can write c:/windows/system32 :-). Forward slashes work for some relative paths for

Re: What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread W. eWatson
Steve Holden wrote: You need to read up on string literals is all. \\ is simply the literal representation of a string containing a single backslash. This comes about because string literals are allowed to contain special escape sequences which are introduced by a backslash; since this gives

Re: What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread Steve Holden
W. eWatson wrote: Steve Holden wrote: You need to read up on string literals is all. \\ is simply the literal representation of a string containing a single backslash. This comes about because string literals are allowed to contain special escape sequences which are introduced by a

Re: What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread Tim Chase
W. eWatson wrote: What am I missing here? Looks OK to me. abc.replace(r'\',r'z') SyntaxError: invalid syntax A raw string can't end in a single backslash (something that occasionally annoys me, but I've learned to deal with it). s=r'\' File stdin, line 1 s=r'\' ^

Re: What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread MRAB
W. eWatson wrote: Steve Holden wrote: You need to read up on string literals is all. \\ is simply the literal representation of a string containing a single backslash. This comes about because string literals are allowed to contain special escape sequences which are introduced by a backslash;

Re: What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread Alf P. Steinbach
* Tim Chase: Alf P. Steinbach wrote: that you cannot write e.g. c:\windows\system32, but must write something like c:\\windows\\system32 (try to print that string), or, since Windows handles forward slashes as well, you can write c:/windows/system32 :-). Forward slashes work for some relative

Re: What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread Nobody
On Sun, 31 Jan 2010 13:41:55 -0600, Tim Chase wrote: The previous absolute-path fails in cmd.exe for a variety of apps because the / is treated as a parameter/switch to the various programs. Fortunately, the Python path-handling sub-system is smart enough to do the right thing, even when