【文件属性】:
文件名称:popen:一个类似于 DSL 前端的 shell,用于 subprocess.Popen
文件大小:10KB
文件格式:ZIP
更新时间:2021-06-28 07:45:43
Python
弹出
它是什么?
popen包在 python 中提供了一个简单的类似 shell 的语法来运行外部命令。
特征:
链接(又名管道)为Sh('ls') | 'sort' Sh('ls') | 'sort'
将标准错误重定向到标准输出作为Sh('make').include_stderr | 'wc' Sh('make').include_stderr | 'wc'
将输出重定向到文件Sh('ls') > '~/listing.txt'
对输出行for line in Sh('ls'):迭代,如for line in Sh('ls'):
将输入流式传输到链中的命令中作为Sh.pipe('~/listing.txt').Sh('grep', '-q', 'code').returncode
扩展特殊字符 ( ~*!? )
将 env vars ( $HOME ) 扩展为pri