Introduction: 1, describes how to run in a non-default path to the command line.
2, describes the use of sys.argv
1. Write a program within the script
import sys print(sys.argv)
2. Run the command line
My path is G: / Python study, not in the installation path, and therefore need to right in the left margin pycharm - "show in explorer, will pop up .py file folder, and then Shift + Right -" Open command here Row.
In the command line input test.py, after the carriage return will pop up pycharm software, but will not run;
At the command line, type python test.py, will run directly after the carriage return.
3. Run results
The results returned to the path of the script.
If the input something in the command line, it returns a list, the contents were sys.argv [0], sys.argv [1], sys.argv [2] ......
4. Summary
This, sys.argv [] usage became clear command whose role is to get input. For example, a program has three functions: upload, download, delete. This requires the user to input three key words to get the corresponding function, the program can be used argv [] to obtain what is entered by the user.