When the output of the script is sent to the “Python 3.7.4 Shell” window of IDLE, the standard output is in blue and the standard error output is in red.
This is standard output. This is also standard output. This is standard error output.
Every Python program is born with two channels through which it can send output to the outside world:
sys.stdout
for normal output and other good news.sys.stderr
in a non-interactive script for warnings, error messages, and other bad news.
We have already seen the
sep
and
end
keyword
parameters
of
print
.
The
file
keyword parameter
of
print
defaults to
sys.stdout
.
An
interactive
script is one that prints questions and lets the user type in answers.
We have already printed with the
print
function,
and soon we will allow the user to type in input with the
input
function.
So for the time being our scripts are interactive.
An interactive script should produce its output
via the standard output channel.
The standard error output channel is intended for use by non-interactive scripts that produce voluminous error messages (many pages) that will be stored in a separate output file that people will look at later.