我正在PyCharm中调试这个脚本:
import sys
def read_in():
lines = sys.stdin.readlines()
for i in range(len(lines)):
lines[i] = lines[i].replace('\n','')
return lines
def main():
lines = read_in()
print lines
if __name__ == '__main__':
main()
我通常使用类似于
cat data.txt | python script.py
的命令来运行这个脚本,它将data.txt文件输入到标准输入中。现在我想知道如何在PyCharm中设置一个“运行/调试配置”,以相同的方式将data.txt文件输入到标准输入中,并且能够使用PyCharm强大的调试模式。我怀疑我需要正确填写“脚本参数”字段,但是迄今为止我还没有搞清楚。谢谢。