The subprocess module provides more powerful facilities for spawning
new processes and retrieving their results; using that module is
preferable to using this function. See the Replacing Older Functions
with the subprocess Module section in the subprocess documentation for
some helpful recipes.
如果您在windows上运行python(cpython)
<built-in function system>
os.system将在幕后执行_wsystem,而如果您使用的是非windows操作系统,它将使用system。你知道吗而子流程调用将在windows上使用CreateProcess,在基于posix的操作系统上使用_posixsubprocess.fork_exec。你知道吗
以上几点应该回答你关于主要差异的问题(结构上)。。。也就是说,我建议您遵循os.system文档中最重要的建议,即:
相关问题 更多 >
编程相关推荐