Command line arguments in Python are handled by a module named sys. The sys module provides functions and variables that can be used to manipulate parts of the Python runtime environment. The argv is one of the features provided by the sys module, and it’s a list in Python, which contains the command-line arguments passed to the script.
This is an example of how to use command line arguments:
```
print(“Name of the script: “, sys.argv0) # the script name (it could be the full path depending on how your program was started)
print(“Number of arguments: “, len(sys.argv)) # number of cmd arguments including the script name
print(“The arguments are: “ , str(sys.argv)) # full command-line
```
If you’ll run a script like this:
`python test.py arg1 arg2 arg3`
The output will be:
```
Name of the script: test.py
Number of arguments: 4
The arguments are: [‘test.py’, ‘arg1’, ‘arg2’, ‘arg3’]
```
sys.argv0 is always the name (or path) of the script itself. The actual command line arguments start from sys.argv1 to sys.argv[n].