[Tutor] command lines

Alan Gauld alan.gauld at btinternet.com
Tue May 8 15:37:49 CEST 2007

"Rikard Bosnjakovic" <rikard.bosnjakovic at gmail.com> wrote in message 
news:d9e88eaf0705060844t49f4b07aq2fe9ba7885695234 at mail.gmail.com...
> On 5/6/07, Jason Coggins <jason at asahnekec.com> wrote:
>> Is there a way to send a command to the Linux Terminal
>> from inside a Python program?

To be picky you don't send the command to the Terminal
but to the OS. But the output will appear in the terminal which
is what I assume you mean... :-)

> os.system(), os.popen(), etc.

Also the commands module or the more recent
subprocess module which is intended to replace
all of the previous mechanisms eventually.

See my OS topic in my tutor for examples of all of these.

Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list