os.system无法正确处理转义的Windows路径

时间:2018-02-07 03:10:51

标签: python windows path escaping

有人可以解释为什么这段代码:

import os

t = '"X://Program Files/MPC-HC/mpc-hc64.exe"' + ' ' + '"X://Movies/test play/test play - 720p Version/' + "test-play1" + '.mkv"'
os.system(t)
print t

抛出:

'X://Program' is not recognized as an internal or external command, operable program or batch file.

但直接粘贴

"X://Program Files/MPC-HC/mpc-hc64.exe" "X://Movies/test play/test play - 720p Version/test-play1.mkv"

进入cmd有效吗?

0 个答案:

没有答案