The following code uses the rpm module to query the version of an installed package.  What I would like to do is to query a set of packages specified by a glob, for example searchi开发者_JAVA技巧ng for "python*" rather than "python".  Is this possible using the rpm module?
  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']
`
import rpm
ts = rpm.TransactionSet()
mi = ts.dbMatch()
mi.pattern('name', rpm.RPMMIRE_GLOB, 'py*' )
for h in mi:
   # Do something with the header... 
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论