A system() command might be frequently used when you were interacting with the system or other scripts.
Try help(os.system) will only show:
system(command) -> exit_status
Execute the command (a string) in a subshell.
And it talks nothing about the exit status.
This function appears in the tutorial as an example and in library reference:
- Execute the command (a string) in a subshell. This is implemented by calling the Standard C function system(), and has the same limitations. Changes to
sys.stdin, etc. are not reflected in the environment of the executed command.
On Unix, the return value is the exit status of the process encoded in the format specified for wait(). Note that POSIX does not specify the meaning of the return value of the C system() function, so the return value of the Python function is system-dependent.
On Windows, the return value is that returned by the system shell after running command, given by the Windows environment variable COMSPEC: on command.com systems (Windows 95, 98 and ME) this is always
0; on cmd.exe systems (Windows NT, 2000 and XP) this is the exit status of the command run; on systems using a non-native shell, consult your shell documentation.
Availability: Macintosh, Unix, Windows.
- Wait for completion of a child process, and return a tuple containing its pid and exit status indication: a 16-bit number, whose low byte is the signal number that killed the process, and whose high byte is the exit status (if the signal number is zero); the high bit of the low byte is set if a core file was produced. Availability: Macintosh, Unix.
Here is a link talking about the return code of os.system(). http://mail.python.org/pipermail/python-list/2001-March/073147.html