How to execute a linux command by python?

Steven Bethard steven.bethard at gmail.com
Wed Oct 18 14:20:33 EDT 2006


Daniel Nogradi wrote:
>> > How to execute a linux command by python?
>> > for example: execute "ls"  or "useradd oracle"
>> > Who can help me?
>>
>> start here:
>>
>>      http://www.python.org/doc/lib/
> 
> And continue here:
> 
> http://www.python.org/doc/lib/os-process.html

You probably should use the subprocess module instead:

http://www.python.org/doc/lib/module-subprocess.html

I've had much better cross-platform results with that.

STeVe



More information about the Python-list mailing list