在 pycharm 中使用标准输入 [英] using stdin in pycharm
问题描述
我已经开始使用 pycharm,但我似乎不能
I have started to use pycharm and i can't seem to
在我用来以这种方式运行程序的命令行中:
in the command line i use to run the program in this way:
python parse_file.py < test.txt
当 parse_file.py 可以简单为:
when parse_file.py can be simple as :
import sys
for line in sys.stdin:
print line
我在配置中找不到在哪里做我尝试在脚本参数中输入类似 <test.txt
的东西,但没有成功
i cant find in the configuration where to do it i tried typeing something like <test.txt
in the script parameters but no luck
我看过https://www.jetbrains.com/pycharm/help/run-debug-configuration-python.html
但也没有运气
谢谢
推荐答案
PyCharm 的运行配置不支持标准输入重定向.请考虑更改您的脚本,使其直接从文件读取其输入,而不是通过标准输入重定向.
PyCharm's run configurations do not support standard input redirection. Please consider changing your script so that it reads its input from a file directly, and not through the standard input redirection.
这篇关于在 pycharm 中使用标准输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!