vscode 输入重定向无法正常工作
vscode input redirection not work properly
我正在使用 vscode。
我想在 vscode 中 运行 宁 python 时从 input.txt 获得输入。
所以我设置 launch.json 如下所示。 (添加了“args”)
{
"version": "0.2.0",
"configurations": [
{
"args": [
"<",
"input.txt"
],
"name": "Python: Curre545435nt File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
}
]
}
(参考:https://code.visualstudio.com/docs/editor/debugging#_redirect-inputoutput-tofrom-the-debug-target)
现在,当我 运行 python、vscode 发送如下命令时。
c:; cd 'c:\Users\user\Desktop\ct'; &
'C:\Users\user\miniconda3\python.exe'
'c:\Users\user\.vscode\extensions\ms-python.python-2021.9.1230869389\pythonFiles\lib\python\debugpy\launcher'
'13094 ' '--' 'c:\Users\user\Desktop\workingfolder\.vscode\launch.json'
'<' 'C:\Users\user\Desktop\workingfolder\input.txt'
这里的问题是 <. ('<')
直接在终端测试的结果,确认应该如下图修改为运行才合适。
'python.exe' '<' 'input.txt' (not correct)
'python.exe' < 'input.txt' (correct)
我需要在 vscode 中设置哪些设置才能正常工作?
PowerShell 好像暂时不行,你可以试试切换到cmd
.
如果不知道如何切换终端类型,可以参考here。
我正在使用 vscode。
我想在 vscode 中 运行 宁 python 时从 input.txt 获得输入。
所以我设置 launch.json 如下所示。 (添加了“args”)
{
"version": "0.2.0",
"configurations": [
{
"args": [
"<",
"input.txt"
],
"name": "Python: Curre545435nt File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
}
]
}
(参考:https://code.visualstudio.com/docs/editor/debugging#_redirect-inputoutput-tofrom-the-debug-target)
现在,当我 运行 python、vscode 发送如下命令时。
c:; cd 'c:\Users\user\Desktop\ct'; &
'C:\Users\user\miniconda3\python.exe'
'c:\Users\user\.vscode\extensions\ms-python.python-2021.9.1230869389\pythonFiles\lib\python\debugpy\launcher'
'13094 ' '--' 'c:\Users\user\Desktop\workingfolder\.vscode\launch.json'
'<' 'C:\Users\user\Desktop\workingfolder\input.txt'
这里的问题是 <. ('<')
直接在终端测试的结果,确认应该如下图修改为运行才合适。
'python.exe' '<' 'input.txt' (not correct)
'python.exe' < 'input.txt' (correct)
我需要在 vscode 中设置哪些设置才能正常工作?
PowerShell 好像暂时不行,你可以试试切换到cmd
.
如果不知道如何切换终端类型,可以参考here。