September 2018
Intermediate to advanced
426 pages
10h 46m
English
The sys module will allow us to interact with the interpreter and it contains most of the information related to the execution in progress, updated by the interpreter, as well as a series of functions and low-level objects.
sys.argv contains the list of parameters for executing a script. The first item in the list is the name of the script followed by the list of parameters.
We may, for example, want to parse command-line arguments at runtime. The sys.argv list contains all the command-line arguments. The first sys.argv[0] index contains the name of the Python interpreter script. The remaining items in argv array contain the next command-line arguments. Thus, if we are passing three additional arguments, sys.argv should ...