Python sys Module
The sys module is a standard module in which we manage the Python version installed on our system. Using this module we can use functions and features specific to the Python system. Here we will only talk about the most necessary features of this module.
sys.exit () function
This function terminates our running Python program.
import sys a = input("a:") b = input("b:") sys.exit() c = input("c:")
stderr ve stdout
When our applications and processes are running, computers use the following files to output and receive input.
stdin: This standard file allows the process to receive input from the user.
stdout: This standard file allows our process to output.
stderr: This standard file is used to output error messages of our process.
When we use our print () function, stdout is used as standard. However, we can also write something to * stderr.
import sys sys.stderr.write("output: error message\n") sys.stderr.flush() sys.stdout.write("output: normal message\n")