【发布时间】:2012-08-22 13:27:02
【问题描述】:
可能重复:
Running shell command from python and capturing the output
当我想捕获 shell 执行输出时,我会这样做。
declare TAGNAME=`git describe --tags`
简单。我在 Python 中寻找过这个,但它们中的大多数看起来都非常复杂。最简单的方法是什么?是的,我知道我可以创建一个函数,但我想知道预定义函数是否存在。
tagname = theFunc('git describe --tags')
【问题讨论】: