Home > Article > Backend Development > Python command line parameters sys.argv
The command line parameters are obtained through sys.argv[]. sys.argv[0] is the path of the code file itself, so the parameters start from 1. For example, the setting parameters are: spe
Python code:
import os, sys
os.system(sys.argv[1])
os.system is used to execute the command line. Therefore, the program will receive the first parameter spe, and then execute spe on the command line. In this way, spe (Python IDE) will be opened.
The above is the detailed content of Python command line parameters sys.argv. For more information, please follow other related articles on the PHP Chinese website!