all Python 3systerm
sys.stderr
streams
The standard error stream. Tracebacks and diagnostics go here so they do not mix with the result.
Syntax
print('ошибка', file=sys.stderr)
stderr is not block-buffered, so messages show up immediately even when stdout is redirected to a file. Judging systems usually compare stdout only: debug output to stderr does not spoil the answer, while output to stdout does. Write to it with print(..., file=sys.stderr).
Examples
import sys
print('debug: x = 42', file=sys.stderr) # в поток ошибок, ответ не испорчен
print('42') # → 42 — ответ идёт в stdout
See also
Open in the full glossarydocs.python.orgReport an inaccuracy