Re: How to split with "\" character, and licence copyleft mirror of ©

random832 at fastmail.us random832 at fastmail.us
Fri Sep 6 09:29:00 EDT 2013


On Thu, Sep 5, 2013, at 23:33, Tim Roberts wrote:
> random832 at fastmail.us wrote:
> >
> >Of course, in 99% of situations where you can use a windows pathname in
> >Python, you are free to use it with a forward slash instead of a
> >backslash.
> 
> This is actually worth repeating, because it's not well known.
> 
> ALL Windows APIs handle forward and backward slashes interchangably.  It
> is only the command interpreter that requires the backslash.

Technically, that's not strictly true. There are certain strings you can
open that will only work with backslashes, relating to device paths
and/or the magic \\?\ prefix that removes the PATH_MAX limit
(CreateFileW only). That was what I meant by 99%.

And many situations in the command interpreter that require a backslash
can be used with forward slash by surrounding the string in quotes,
which you need to do anyway when you have an arbitrary string that may
contain spaces.



More information about the Python-list mailing list