Are the standard input, output, and error constants defined in the standard library?

I cannot find these basic constants anywhere in the Python library.

STDIN = 0
STDOUT = 1
STDERR = 2

This is trivial, but I just can't believe that I have to define them myself.

+4
source share
2 answers

Values ​​can be determined from the module sys:

sys.stdout.fileno()
sys.stdin.fileno()
sys.stderr.fileno()
+6
source

pty.STDIN_FILENO, pty.STDOUT_FILENO, pty.STDERR_FILENO

0
source

Source: https://habr.com/ru/post/1618547/


All Articles