How to execute a linux command by python?

Mark Elston m.elston at advantest-ard.com
Wed Oct 18 14:49:18 EDT 2006


* venkatbo at yahoo.com wrote (on 10/18/2006 11:32 AM):
> Fredrik Lundh wrote:
>> haishan chang 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/
>>
>> </F>
> 
> After reading the matl. pointed to by the many links listed here,
> you can try pexpect. Provided for more control and interactivity.
> More at: http://pexpect.sourceforge.net/
> 
> /venkat
> 

BTW, is there a version of pexpect that works with Windows?  This
package requires pty and termios which isn't supported on Windows.

Mark



More information about the Python-list mailing list