How to change '\\' to '\'

Peter J. Holzer hjp-python at hjp.at
Mon Oct 1 05:28:50 EDT 2018


On 2018-10-01 17:19:25 +0800, Jach Fong wrote:
> Sure the forward slash is better, not to cause this confusion.
> But I am curious, since when, I mean, since which version
> Windows start to accept forward slash?

Since MS-DOS 2.0, i.e., before Windows even existed. Note that this is
only true for system call paraeters[1], not for command line parameters. 

So for your use case:

> > > > I want to use this "string" in a subprocess command as a parameter.

you probably need to use backslashes, not forward slashes (it depends on
the program you are calling).

        hp

[1] And even there not always, as I've learned from the resident Windows
    expert on this list.

-- 
   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp at hjp.at         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20181001/f9a58062/attachment.sig>


More information about the Python-list mailing list