Enter python from the command line
Open cmd-enter python directly, as follows
Exit python
Method 1: Press Ctrl+z first, and then press Enter (Enter)
Method 2: Type exit() and press enter
Method 3: Enter quit() and press enter
Knowledge point expansion:
Command line mode and python interactive mode
Select "Command Prompt" in the Windows Start Menu to enter the command line mode. Its prompt is similar to C::.
Two, Python interactive mode
Knock on the command python in the command line mode, and you will see a bunch of text output similar to the following, and then enter the Python interactive mode, and its prompt is.
Enter exit() in the Python interactive mode and press Enter to exit the Python interactive mode and return to the command line mode: you can also directly select the Python (command line) menu item through the start menu to directly enter the Python interactive mode, but enter After exit(), the window will be closed directly without returning to the command line mode.
Three, the command line mode is distinguished from the Python interactive mode
1、 In the command line mode, you can execute python to enter the Python interactive environment, or execute python hello.py to run a .py file. Executing a .py file can only be executed in command line mode.
2、 The code in the Python interactive mode is to input one line and execute one line, while running the .py file directly in the command line mode executes all the codes in the file at once.
3、 The Python interactive mode is mainly for debugging Python code.
So far this article on how to enter python through the command line is introduced. For more information about how to enter python through the command line, please search for ZaLou.Cn's previous articles or continue to browse the related articles below. Hope you will support ZaLou more in the future .Cn!
Recommended Posts