| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1648 人关注过本帖
标题:(求助)这句含“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
快速回复:(求助)这句含“Popen”的语句是什么意思?
数据加载中...
 
   



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

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