2.1 Calling the Python interpreter
The Python interpreter has simple line editing capabilities. On Unix systems, any Python interpreter may have added the GNU readline Library support, which has features such as sophisticated interactive editing and historical recording. Entering CONTROL-P in the Python main window may be the simplest way to check whether command-line editing is supported. If you make a beep (computer speaker), you can use the command-line editing feature, and for more shortcuts, refer to interactive input line editing history backtracking . If there is no sound, or if a character is displayed ^P , the command-line editing function is not available; You can only remove the characters you have typed from the current row and reenter them by backspace.
2.1.1. Parameter passing
When the interpreter is invoked, the script name and additional parameters are passed into asys.argvList of strings. You can get this list by executingimport sys, the length of the list is greater than or equal to 1, and there is at least one element when no script or parameter is given:sys.argv[0]This is an empty string. The script name is specified as‘-‘(indicates standard input),sys.argv[0]is set to‘-‘, using the-CinstructionWhensys.argv[0]is set to‘-c‘。 Using-MModuleparameter,sys.argv[0]is set to the full name of the specified module. -CinstructionOr-MModuleThe following parameters are not intercepted by the Python interpreter's option handling mechanism, but are left insys.argvFor the script command operation.
2.2 Interpreter and its environment
By default, the Python source file is UTF-8 encoded.
2. Using the Python Interpreter