python的os.system()执行windows命令的时候报错:
cd_dir = 'cd C:\Users\Lenovo\AppData\Local\Google\Chrome\Application'
start_proxy = 'chrome.exe --remote-debugging-port=9222 --user-data-dir="C:\selenum\AutomationProfile"'
os.system(cd_dir)
time.sleep(0.5)
os.system(start_proxy)
解决方法:在字符串前加r
cd_dir = r'cd C:\Users\Lenovo\AppData\Local\Google\Chrome\Application'
start_proxy = r'chrome.exe --remote-debugging-port=9222 --user-data-dir="C:\selenum\AutomationProfile"'
os.system(cd_dir)
time.sleep(0.5)
os.system(start_proxy)