sys module in python

preview_player
Показать описание
In this video you will learn about various variables and functions of sys module in python.

sys module python

The sys module is a built in module in python. It provides several functions and variables to manipulate the python runtime environment. To use its functions we have to import it. The commonly used functions and variables of sys module are as follows:
• exit(): This function is used to terminate a program when needed. It can also be used to exit from the python terminal.
import sys
print("Hello World")#prints Hello World
print("Bye World")#It will not run

• path: This variable shows the value of PYTHON PATH environment variable which is set in the current system.
import sys

• platfom: This variable is used to identify the host operating system which we are using.
import sys

• executable : This specifies the path of python executable file.
import sys

• modules: Returns the list of available modules.
import sys

• copyright : This shows the copyright info.
import sys

• argv : This is actually a list which stores the command line arguments. The command line arguments or CLA are the parameters which are passed from command prompt while executing a python program. They are similar to command line arguments of C/C++/Java.
import sys
print(x)
The first command line argument is the name of the python file itself.

Besides the above, the sys module also provides various properties like stdin, stdout, and stderr that can be used to redirect the standard input, output and error streams. You can find out complete details on following page:

#python_by_tarun_sir #tarun_sir #python #tarun_sir_python #python_video_58 #sys_module_in_python #python_tutorial #command_line_arguments_in_python #exit_function_in_python
Рекомендации по теме
Комментарии
Автор

Sir if possible plz improve microphone 🎤🎤 quality
Explaintion is amazing outstanding

AnilYadav-lsrr
Автор

Koii bhi vedio bna rahe to voice clear krr Leni chahiye..aur Aram se bolna chahiye ..
Kyoki Agar koii aapka vedio Sun raha ho to usko clear samajh me aa Jaye

creativeartswithpooja
Автор

Sir ye aapka ye word document kidr milega

sahilmahla
Автор

sir where can i use that sys.argv function in actual code?

abhishekwaghmare