os.system questions

Thomas Krüger newsgroups at nospam.nowire.org
Sat Mar 31 14:44:01 CEST 2007

Eric Price schrieb:
> up = os.system("uptime")
> How do I assign the output of "uptime" to the variable "up"?

| >>> print os.system.__doc__
| system(command) -> exit_status
| Execute the command (a string) in a subshell.

os.system returns the exitcode of the given command. To get the output
try os.popen to os.popen4 or the commands lib.


More information about the Python-list mailing list