Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python程序在终端和文件中的输出结果_Python_Shell_Terminal_Output - Fatal编程技术网

python程序在终端和文件中的输出结果

python程序在终端和文件中的输出结果,python,shell,terminal,output,Python,Shell,Terminal,Output,我尝试过这个方法,但该命令是一个python程序,它有一个输入“raw_input()” 当程序请求输入时,输出停止。有几种方法可以解决这个问题raw_input()读取标准输入(stdin),该输入可以从管道、文件甚至其他进程重定向: 使用管道: echo "some text" | someCommand | tee someFile 从文件中: someCommand < inputfile | tee someFile someCommand

我尝试过这个方法,但该命令是一个python程序,它有一个输入“raw_input()”


当程序请求输入时,输出停止。有几种方法可以解决这个问题
raw_input()
读取标准输入(
stdin
),该输入可以从管道、文件甚至其他进程重定向:

使用管道:

echo "some text" | someCommand | tee someFile
从文件中:

someCommand < inputfile | tee someFile
someCommand
从另一个程序:

someCommand < <(anotherprog) | tee someFile

someCommand<有几种方法可以解决这个问题
raw_input()
读取标准输入(
stdin
),该输入可以从管道、文件甚至其他进程重定向:

使用管道:

echo "some text" | someCommand | tee someFile
从文件中:

someCommand < inputfile | tee someFile
someCommand
从另一个程序:

someCommand < <(anotherprog) | tee someFile

someCommandsomeCommand
需要一些输入,如果没有输入,您希望该命令做什么?问题是您没有看到输入提示?是的,我没有看到输入提示如果
someCommand
需要一些输入,如果没有输入,您还希望该命令做什么?问题是您没有看到输入提示?是的,我没有看到输入提示