简体   繁体   中英

Extract a rar file in a double quoted folder with python

Hi how i can add the double quotes to a folder ? with a initial " and a final " ? in a python file without receiving errors ?

this is the bat file with quotes

 rar.exe x -o+ -p12345pass temp.rar "%Localappdata%\\Temp\\"

and this is the python file without quotes

 win32api.WinExec("cmd.exe /c rar.exe x -o+ -p12345pass temp.rar %Localappdata%\\\\Temp\\\\",0)

使用单引号也可以帮助您:

win32api.WinExec('cmd.exe /c rar.exe x -o+ -p12345pass temp.rar \"%Localappdata%\\Temp\\\"',0)

在每个引号前使用一个反斜杠

win32api.WinExec("cmd.exe /c rar.exe x -o+ -p12345pass temp.rar \"%Localappdata%\\Temp\\\"",0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM