我正在尝试在系统上执行代码,该代码将文件从直接链接下载到%appdata%Windows上的目录。
我的代码:
def downloadfile():
mycommand = "powershell -command "$cli = New-Object System.Net.WebClient;$cli.Headers['User-Agent'] = {};$cli.DownloadFile('https://drive.google.com/uc?export=download&id=19LJ6Otr9p_stY5MLeEfRnA-jD8xXvK3m', '%appdata%\putty.exe')""
down = subprocess.call(mycommand)
downloadfile()
但我收到此错误:
文件“searchmailfolder.py”,第 4 行 mycommand = “powershell -command”$cli = New-Object System.Net.WebClient;$cli.Headers['User-Agent'] = 'myUserAgentString';$cli.DownloadFile(' https://drive.google.com/uc?export=download&id=19LJ6Otr9p_stY5MLeEfRnA-jD8xXvK3m ', '%appdata%\putty.exe')"" ^ SyntaxError: 无效语法
紫衣仙女
相关分类