How to enter python through the command line

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

  1. Command line 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.

  1. Switch between command line mode and Python interactive mode

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

How to enter python through the command line
How to save the python program
Steps to enter python through cmd
How to view the python module
How to learn the Python time module
How to enter python triple quotation marks
How to use the round function in python
How to use the zip function in Python
How to use the format function in python
How to switch the hosts file using python
How to install the downloaded module in python
Python how to move the code collectively right
Use the command line to detect the Ubuntu version method
How to practice after the python file is written
How to understand the introduction of packages in Python
How to comment python code
How to learn python quickly
How to uninstall python plugin
How to understand python objects
How to use python tuples
How to find the area of a circle in python
python how to view webpage code
How to use python thread pool
How Python implements the mail function
How does python change the environment
How to write python configuration file
How to wrap in python code
How to omit parentheses in Python
How to install Python 3.8 on CentOS 8
How to install Python 3.8 on Ubuntu 18.04
How to write classes in python
How to filter numbers in python
How to read Excel in Python
How to install Python on CentOS 8
How to solve python dict garbled
How to view errors in python
How does python enter interactive mode
How to write return in python
How Python implements the timer function
How to understand variables in Python
How to clear variables in python
How to understand python object-oriented programming
How to use SQLite in Python
How to verify successful installation of python
How to use and and or in Python
How to delete cache files in python
How to introduce third-party modules in Python
How does python improve the calculation speed
How to represent null values in python
How to save text files in python
Python string to judge the password strength
How to use PYTHON to crawl news articles
How to write win programs in python
How to run id function in python
How to install third-party modules in Python
How to custom catch errors in python
How to write try statement in python
How to define private attributes in Python
R&D: How To Install Python 3 on CentOS 7
How to add custom modules in Python
How does Python handle the json module