Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/295.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 subprocess.Popen()和标准文件对象关联_Python_Subprocess - Fatal编程技术网

Python subprocess.Popen()和标准文件对象关联

Python subprocess.Popen()和标准文件对象关联,python,subprocess,Python,Subprocess,我想知道subprocess.Popen()对象和stdout之间的关联,以及它如何将Popen实例转换为文件对象 type(subprocess.Popen) # <type 'type'> subprocess.Popen(":", shell=True).__class__ # <class 'subprocess.Popen'> type(subprocess.Popen(":", shell=True, stdout=subprocess.PIPE).s

我想知道subprocess.Popen()对象和stdout之间的关联,以及它如何将Popen实例转换为文件对象

type(subprocess.Popen)  # <type 'type'>

subprocess.Popen(":", shell=True).__class__  # <class 'subprocess.Popen'>

type(subprocess.Popen(":", shell=True, stdout=subprocess.PIPE).stdout)  # <type 'file'>
type(subprocess.Popen)#
subprocess.Popen(“:”,shell=True)
类型(subprocess.Popen(“:”,shell=True,stdout=subprocess.PIPE).stdout)#
但是,


dir(subprocess.Popen)
没有stdout作为其成员

stdout
是类中的一个属性,定义如下

这是一个属性,请尝试
帮助(subprocess.Popen)