Reputation: 48128
I need to quote a path in a portable way, shlex.quote
is converting slashes to /
on windows, which causes the command to fail (using the default windows command prompt).
Returning C:/Users/Me/Documents/Projects/Test
Instead of C:\Users\Me\Documents\Projects\Test
How can I quote a path on windows, similar to shlex.quote
that uses native slashes, suitable for the windows command prompt and BAT files?
Upvotes: 4
Views: 2048
Reputation: 115
As mentioned by some comments, your problem might not be caused by shlex.quote()
.
Nevertheless there is the module mslex
which provides mslex.quote()
and mslex.split()
for the Windows shell, just like what shlex
provides for the Unix shell.
Upvotes: 2