First acquainted with python, the grammatical rules in python

Reference link: Keyword 1 in Python

Initial python

Python (computer programming language) development history:

Python (British pronunciation: /ˈpaɪθən/ American pronunciation: /ˈpaɪθɑːn/), is an object-oriented interpreted computer programming language, invented by the Dutch Guido van Rossum in 1989, and the first public release was issued in 1991 .

Python is pure free software. The source code and interpreter CPython follow the GPL (GNU General Public License) agreement. Python syntax is concise and clear, and one of its features is to force white space as a statement indentation.

Python has a rich and powerful library. It is often nicknamed the glue language, which can easily connect various modules made in other languages (especially C/C++) together. A common application situation is to use Python to quickly generate the prototype of the program (sometimes even the final interface of the program), and then rewrite the parts with special requirements in a more suitable language, such as the graphics rendering module in 3D games. If the performance requirements are particularly high, it can be rewritten in C/C++, and then packaged as an extended class library that Python can call. It should be noted that you may need to consider platform issues when you use extended class libraries, and some may not provide cross-platform implementation.

7 On the 20th, IEEE released the 2017 Programming Language Ranking: Python ranked first.

Introduction to Python Features:

Python is a high-level scripting language that combines interpretation, compilation, interactivity, and object-oriented.

Python is designed to be very readable. Compared with other languages, English keywords are often used, and some punctuation marks of other languages have a more distinctive grammatical structure than other languages.

Python is an interpreted language: This means that there is no compilation part in the development process. Similar to PHP and Perl languages. Python is an interactive language: This means that you can directly execute and write your program interactively at a Python prompt. Python is an object-oriented language: This means that Python supports an object-oriented style or programming technique where code is encapsulated in objects. Python is a language for beginners: Python is a great language for junior programmers. It supports a wide range of application development, from simple word processing to WWW browsers to games.

How is the program executed?

How the program works

Three big pieces of computer

The computer contains a lot of hardware, but a program has to run, and there are three core hardware, namely: 1.cpu (cpu is for work, you can't work without the cpu) The central processing unit is a large Large-scale integrated circuits are responsible for processing data/calculation 2. Memory (temporary storage of data in units of G 4G 8G 16G 32G) Temporary storage of data (data will disappear after power failure) Fast speed and small space (high unit price) 3. Hard disk ( The unit of permanent storage of data is T 1T=1024G) The permanent storage of data is slow and the space is large (low unit price) Questions: 1. Which hardware device in the computer is responsible for executing the program? CPU 2. The speed of the memory or the speed of the hard disk ? Memory 3. Is our program installed in the memory or in the hard disk? Hard disk 4. I bought a memory stick with 500G space, is this correct? No, the memory stick is usually only 4G/8G /16G/32G 5. After the computer is shut down, will the data in the memory disappear? Yes, the principle of program execution 1. Before the program runs, the program is saved in the hard disk 2. When a program is to be run, the operating system will first Let the CPU copy the program to the memory. The CPU executes the code in the memory. The program must first be loaded into the memory. The language of the program execution. 1. The operating system first lets the CPU copy the program of the python interpreter to the memory. The interpretation of python How big is the device? [root@foundation1 python]# which python /bin/python [root@foundation1 python]# ls -lh /bin/python lrwxrwxrwx. 1 root root 7 Apr 9 17:34 /bin/python -> python2 [root@foundation1 python]# ls -lh /bin/python2 lrwxrwxrwx. 1 root root 9 Apr 9 17:34 /bin/python2 -> python2.7 [root@foundation1 python]# ls -lh /bin/python2.7 -rwxr-xr-x. 1 root root 7.0K Aug 2 2016 /bin/python2.7 # The purpose of establishing a soft link is to facilitate the user not to remember which specific version of the interpreter is used

  1. The python interpreter allows the CPU to translate the code in the python program from top to bottom according to the grammatical rules 3. The CPU is responsible for executing the translated code program: the program is used to process data

The grammatical rules of python:

Its elegant rules dictate its strict indentation

Can be spliced

Execute line break by line means a new sentence. The interpreter reads one line, translates one line, translates one line, and executes one line. Some old versions do not recognize Chinese. You need to add # * coding:utf-8 _* before the code _

Edit a python file:

1 vim python.py print'python yuhan' #print: print out the contents of ``2 python python.py #python is the default interpreter for .py language

error:

1 printt'python yuhan' #Keyword output error 2 print'python yuhan' print'python yuhan' #Branch execution 3 print'python yuhan' print'python yuhan' #Indentation is not aligned 4 #print: Print output Content print'python yuhan'

Python does not recognize Chinese by default# * coding:utf-8 * # #print: Print the content inside ``# print'python yuhan'

Recommended Posts

First acquainted with python, the grammatical rules in python
For the first time in history, Python surpassed Java!
The usage of wheel in python
Getting started with Numpy in Python
​What are the numbers in Python?
Talking about the modules in Python
The usage of tuples in python
Understanding the meaning of rb in python
The usage of Ajax in Python3 crawler
Python randomly shuffles the elements in the list
What is the function of adb in python
How to use the round function in python
Explain the list under Python multithreading in detail
How to use the zip function in Python
An article to understand the yield in Python
What does the tab key in python mean
Python implements the shuffling of the cards in Doudizhu
The meaning and usage of lists in python
How to use the format function in python
Where is the IDE that comes with Python
The consequences of uninstalling python in ubuntu, very
How to install the downloaded module in python
The best way to judge the type in Python
Functions in python
2.1 The Python Interpreter (python interpreter)
Realize the tank battle game with Python | Dry Post
How to understand the introduction of packages in Python
General outline for the first day of learning python
Python data visualization: who are the big names in Python?
What are the ways to open files in python
Realize the tank battle game with Python | Dry Post