|An Introduction to Python|
by Guido van Rossum and Fred L. Drake, Jr.
Paperback (6"x9"), 124 pages
RRP £12.95 ($19.95)
Sales of this book support the Python Software Foundation! Get a printed copy>>>
10.4 Error Output Redirection and Program Termination
The ‘sys’ module also has attributes for stdin, stdout, and stderr. The latter is useful for emitting warnings and error messages to make them visible even when stdout has been redirected:
>>> sys.stderr.write('Warning, log file not found\n') Warning, log file not found
The most direct way to terminate a script is to use ‘sys.exit()’.
|ISBN 0954161769||An Introduction to Python||See the print edition|