简体   繁体   English

Python - os.popen和subprocess.Popen有什么区别?

[英]Python - what is difference in os.popen and subprocess.Popen?

Python - os.popen和subprocess.Popen有什么区别?

The os process functionality is considered obsolete. os进程功能被认为是过时的。 The subprocess module was introduced in Python 2.4 as a unified, more powerful replacement for several older modules and functions related to subprocesses. subprocess模块是在Python 2.4中引入的,它是对几个与子进程相关的旧模块和函数的统一,更强大的替代品。 They are listed here : 它们列在这里

  • os.system
  • os.spawn*
  • os.popen*
  • popen2.*
  • commands.*

os.popen was deprecated in Python 2.6 (but, interestingly, it is not deprecated in Python 3, where it is implemented in terms of subprocess.Popen ). os.popen是在Python 2.6(但是,有趣的是,它不是在Python 3,其中弃用弃用它在以下方面实现subprocess.Popen )。 There is a paragraph in the documentation on how to replace it with subprocess.Popen . 文档中有一段关于如何用subprocess.Popen替换它的段落。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM