Executing a shell command

Oleg Broytmann phd at phd.fep.ru
Sat Jun 2 07:00:27 EDT 2001


On Fri, 1 Jun 2001, Kevin Riggle wrote:
> Is there any way to take a command in a string in Python, execute it in the
> shell, and read the output into a variable of some sort, like

   pipe = os.popen(command, 'r')
   data = pipe.read()
   pipe.close()

Oleg.
----
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list