下面的代码使用rpm模块来查询已安装包的版本。我想要做的是查询一组由glob指定的包,例如搜索"python*"而不是"python"。使用rpm模块可以吗?
1 #!/usr/bin/python
2
3 import rpm
4
5 ts = rpm.TransactionSet()
6 mi = ts.dbMatch("name", "python")
7 for i in mi:
8 print i['name'], i['version']`
发布于 2010-07-26 01:36:20
import rpm
ts = rpm.TransactionSet()
mi = ts.dbMatch()
mi.pattern('name', rpm.RPMMIRE_GLOB, 'py*' )
for h in mi:
# Do something with the header... https://stackoverflow.com/questions/3311760
复制相似问题