Linux - python vs sh

Erik de Castro Lopo nospam at mega-nerd.com
Thu Jul 17 11:25:13 CEST 2003


Krisztian Kepes wrote:
> 
> Hi !
> 
> I want to list my rpm database to file with this:

<snip>

> But how I get the rpm's output in my py program ?
> list= rpm -qa

import commands, string
[status, rpmoutput] = commands.getstatusoutput('rpm -qa')
rpmlist = string.split (rpmoutput, '\n')

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam at mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
Q. What is the difference between Jurassic Park and Microsoft?
A. One is an over-rated high tech theme park based on prehistoric
   information and populated mostly by dinosaurs, the other is a 
   Steven Spielberg movie.




More information about the Python-list mailing list