python标准库介绍——34 commands 模块详解
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python标准库介绍——34 commands 模块详解相关的知识,希望对你有一定的参考价值。
==commands 模块== (只用于 Unix) ``commands`` 模块包含一些用于执行外部命令的函数. [Example 3-7 #eg-3-7] 展示了这个模块. ====Example 3-7. 使用 commands 模块====[eg-3-7] ``` File: commands-example-1.py import commands stat, output = commands.getstatusoutput("ls -lR") print "status", "=>", stat print "output", "=>", len(output), "bytes" *B*status => 0 output => 171046 bytes*b* ```
以上是关于python标准库介绍——34 commands 模块详解的主要内容,如果未能解决你的问题,请参考以下文章