Sys Module in Python

Python sys.version

In this example, sys.version is used which returns a string containing the version of Python Interpreter with some additional information. This shows how the sys module interacts with the interpreter. Let us dive into the article to get more information about the sys module.

Python3




import sys
print(sys.version)


Output:

3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0]

Python sys Module

The sys module in Python provides various functions and variables that are used to manipulate different parts of the Python runtime environment. It allows operating on the interpreter as it provides access to the variables and functions that interact strongly with the interpreter. Let’s consider the below example.

Similar Reads

Sys Module in Python

Python sys.version...

Input and Output using Python Sys

...

Command Line Arguments

The sys modules provide variables for better control over input or output. We can even redirect the input and output to other devices. This can be done using three variables –...

Exiting the Program

...

Working with Modules

...

Reference Count

...

More Functions in Python sys

Command-line arguments are those which are passed during the calling of the program along with the calling statement. To achieve this using the sys module, the sys module provides a variable called sys.argv. It’s main purpose are:...