gpt4 book ai didi

python - 捕获shell执行输出的简单python命令?

转载 作者:太空宇宙 更新时间:2023-11-03 13:21:34 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Running shell command from python and capturing the output

当我想捕获 shell 执行输出时,我会这样做。

declare TAGNAME=`git describe --tags` 

简单。我在 Python 中寻找过这个,但它们中的大多数看起来非常复杂。最简单的方法是什么?是的,我知道我可以创建一个函数,但我想知道预定义函数是否存在。

tagname = theFunc('git describe --tags')

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com