通过子流程模块在Python中执行Cut命令

通过子流程模块在Python中执行Cut命令,python,subprocess,cut,Python,Subprocess,Cut,如何运行以下行 subprocess.Popen(('cut', '-d', '" "', '-f', '1'), stdin=out_2.stdout, stdout=subprocess.PIPE) 它返回以下错误: cut: the delimiter must be a single character 不要重复引用: subprocess.Popen(('cut', '-d', ' ', '-f', '1'), stdin=out_2.stdout, stdout=subproce

如何运行以下行

subprocess.Popen(('cut', '-d', '" "', '-f', '1'), stdin=out_2.stdout, stdout=subprocess.PIPE)
它返回以下错误:

cut: the delimiter must be a single character
不要重复引用:

subprocess.Popen(('cut', '-d', ' ', '-f', '1'), stdin=out_2.stdout, stdout=subprocess.PIPE)
                               ^^^

够了

错误消息不再出现,但脚本不起作用,然后问另一个问题,为我们提供更多信息?问一个新的问题,并得到预期的结果?在这种情况下,您真的需要调用
cut
?哦,是的,devnull的意思是:使用python的split()命令。