[Tutor] Issuing Linux commands

S A buc40@bemail.org
Wed, 21 Aug 2002 19:38:11 -0700


Try:
import commands
print commands.getoutput("ls")

This will run the ls command and print it's output to your shell. I think this runs the commands through zsh? To see more:
dir(commands)

Then see what each part does by:
help(commands."whatever")

(substituting whatever for the class method of course.

Hope this helps.
SA


> Charles M Howe <cmhowe@patriot.net> tutor@python.org [Tutor] Issuing Linux commandsDate: Wed, 21 Aug 2002 22:45:32 -0400
>
>Is there a way to issue Linux commands -- ls, mkdir, mv, cp, mc, ...,
>from within python?
>
>Charles m Howe
>
>
>
>_______________________________________________
>Tutor maillist  -  Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor



"I can do everything on my Mac that I used to do on my PC, plus alot more ..."

-Me

------------------------------------------------------------
Free, BeOS-friendly email accounts: http://BeMail.org/
BeOS News and Community: http://www.BeGroovy.com/


---------------------------------------------------------------------
Express yourself with a super cool email address from BigMailBox.com.
Hundreds of choices. It's free!
http://www.bigmailbox.com
---------------------------------------------------------------------