Getting to know Python
Will Ware
wware-nospam at world.std.com
Wed Sep 29 10:17:21 EDT 1999
Adrian Eyre (a.eyre at optichrome.com) wrote:
> > How do I access the shell from the interpreter to enter commands like
> > clear, ls, cp, etc.
> If you're using a shell with job control, I'd cheat, and [hit
> control-Z]
There is a less drastic approach. Either os.system() or
commands.getoutput() will do the same thing without leaving
the interpreter. Using commands.getoutput() will allow you to
get the standard output produced by the command as a Python
string. os.system() returns the exit code from the shell command.
--
- - - - - - - - - - - - - - - - - - - - - - - -
Resistance is futile. Capacitance is efficacious.
Will Ware email: wware @ world.std.com
More information about the Python-list
mailing list