2.1 The Python Interpreter (python interpreter)

2.1 The Python Interpreter

Python is an interpreted language. The Python interpreter can only run one command at a time. The standard Python interpreter environment can be entered by typing python (after typing python in the terminal, you can enter the interpreter):

>>> It is a prompt, telling you that you can enter commands. If you want to exit, you can type exit() or press Ctrl-D.

Running the python program is also very simple, just enter a terminal python+.py file. Suppose our hello_world.py file has the following content

print('Hello world')

You can run it with the following command (remember, hello_world.py must be in the current folder):

If you are doing scientific calculations and data analysis, we usually use IPython, which is an enhanced version of the python interpreter, and Jupyter notebook is a web-based code notebook, which is also developed from the IPython project. Here is a brief introduction to IPython and Jupyter and how to use it. For more information, see Appendix B. When we use the %run command, IPython will execute the file in the way of executing code, allowing us to visually see the result of the interaction:

The default IPython prompt will display numbers, such as the In [2]: in the picture, instead of the normal >>> prompt.

Recommended Posts

2.1 The Python Interpreter (python interpreter)
Consolidate the Python foundation (2)
Consolidate the foundation of Python(7)
python guess the word game
Consolidate the foundation of Python(6)
Ubuntu install the latest Python 3.
Python realizes the guessing game
The difference between Python extensions
Consolidate the foundation of Python (3)
Python implements the brick-and-mortar game
The usage of wheel in python
How Python implements the mail function
How does python change the environment
Python simply implements the snake game
Python handles the 4 wheels of Chinese
Python3 implements the singleton design pattern
How to save the python program
Python simulation of the landlord deal
What is the use of Python
​What are the numbers in Python?
Python implements the steepest descent method
Talking about the modules in Python
The premise of Python string pooling
Secrets of the new features of Python 3.8
How Python implements the timer function
How to view the python module
Python implements the aircraft war project
The father of Python joins Microsoft
The operation of python access hdfs
The usage of tuples in python
End the method of running python
Install the latest Python 3.6 version on Ubuntu
Understanding the meaning of rb in python
Can Python implement the structure of the stack?
Python multithreading
Python CookBook
Python FAQ
Why doesn't Python support the switch statement?
Python3 dictionary
What are the required parameters of python
Python3 module
How does python improve the calculation speed
Logistic regression at the bottom of python
The usage of Ajax in Python3 crawler
Python solves the Tower of Hanoi game
Python basics
Python string to judge the password strength
Solve the conflict of multiple versions of python
Python descriptor
Python basics 2
What is the scope of python variables
Python implements the sum of fractional sequences
Python exec
Python3 tuple
Two days of learning the basics of Python
Python decorator
Python IO
Python multithreading
What is the id function of python
Python toolchain
Python basic actual combat-guess the age game