标题:(求助)这句含“Popen”的语句是什么意思?
只看楼主
xiaoyuer_che
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-9-24
结帖率:0
已结贴  问题点数:0 回复次数:3 
(求助)这句含“Popen”的语句是什么意思?
Popen(cmd, shell = True, stdout = PIPE).communicate()
f = Popen(cmd, shell = True, stdout = PIPE).stdout

刚接触python,不太了解Popen的用法,在网上也搜索不到。麻烦解释一下上面两句。如果有相关的资料推荐,那就更好了!
搜索更多相关主题的帖子: 语句 Popen 
2009-09-24 17:12
gengwenbin
Rank: 2
等 级:论坛游民
帖 子:24
专家分:51
注 册:2009-8-10
得分:20 
没用过这个函数。。。

2009-09-25 17:11
xmnathan
Rank: 2
等 级:论坛游民
威 望:1
帖 子:73
专家分:10
注 册:2008-8-30
得分:0 
管道
很少用到
我的理解是类似水管里不停的往外输出数据,当外部需要调用这些输出数据的时候只要开启一个子进程读取这些数据就可以了

唉 好难
2009-10-19 19:05
abc_echo
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-3-29
得分:0 
import os然后查找popen

popen(...)
        popen(command [, mode='r' [, bufsize]]) -> pipe
        
        Open a pipe to/from a command returning a file object.
   
    popen2(cmd, mode='t', bufsize=-1)
        Execute the shell command 'cmd' in a sub-process.  On UNIX, 'cmd'
        may be a sequence, in which case arguments will be passed directly to
        the program without shell intervention (as with os.spawnv()).  If 'cmd'
        is a string it will be passed to the shell (as with os.system()). If
        'bufsize' is specified, it sets the buffer size for the I/O pipes.  The
        file objects (child_stdin, child_stdout) are returned.
   
    popen3(cmd, mode='t', bufsize=-1)
        Execute the shell command 'cmd' in a sub-process.  On UNIX, 'cmd'
        may be a sequence, in which case arguments will be passed directly to
        the program without shell intervention (as with os.spawnv()).  If 'cmd'
        is a string it will be passed to the shell (as with os.system()). If
        'bufsize' is specified, it sets the buffer size for the I/O pipes.  The
        file objects (child_stdin, child_stdout, child_stderr) are returned.
   
    popen4(cmd, mode='t', bufsize=-1)
        Execute the shell command 'cmd' in a sub-process.  On UNIX, 'cmd'
        may be a sequence, in which case arguments will be passed directly to
        the program without shell intervention (as with os.spawnv()).  If 'cmd'
        is a string it will be passed to the shell (as with os.system()). If
        'bufsize' is specified, it sets the buffer size for the I/O pipes.  The
        file objects (child_stdin, child_stdout_stderr) are returned.
2010-03-29 22:20



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-286684-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.102577 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved