My name is Python Its Chinese name is parson , In English, it means Python , as everyone knows : Snakes are cold-blooded animals , Ferocity , What's more, I'm a python , I'm also simple and brutal 、 So many languages fear me , Many programmers support me , Of course, I also make my supporters very happy , I'm much better than most of their programming languages . The person who made me born in this world is Jim · Van rosum , I want to thank him well . I have now 30 Year old , Everybody says 30 The programming language is about to be eliminated , But I don't believe it , In the first half of my life, I was not well known , So he was buried in the world , In recent years, with the development of artificial intelligence 、 The advent of the era of data science has also brought me into the eyes of the public . My youth is like the rising sun , Dazzling . I believe that my short life will create infinite value for mankind . The next picture is my original face , Please remember me . The next introduction will let you know my character 、 characteristic 、 And what contribution I have made . Please give us a face to understand . If you think we are good, you can give us a little praise , Collect it .
ψ(*`ー´)ψ
It is after so many decades of precipitation , This language gradually appeared in front of people .python development history
It's a long time, but it's hot in recent years , Thanks to AI 、 The advent of the era of data science , With a large number of
Excellent third party Library 、 Concise grammar is deeply loved by people from all walks of life . Once ranked first in the popularity of programming languages .
Python It's an interpretative language : This means that there is no compilation in the development process . Be similar to PHP and Perl Language .
Python It's interactive language : It means , You can be in a Python Prompt >>> Then execute the code directly .
Python It's an object-oriented language : It means Python Support object-oriented style or code encapsulation in object programming technology .
Python It's a beginner's language :Python For junior programmers , It's a great language , It supports a wide range of application development , From simple word processing to WWW Browser to game .
Easy to learn :Python There are relatively few keywords , Simple structure , And a clearly defined grammar , It's easier to learn .
Easy to read :Python More clearly defined code .
Easy to maintain :Python The success is that its source code is fairly easy to maintain .
An extensive library of standards :Python One of the biggest advantages of is rich libraries , Cross platform , stay UNIX,Windows and Macintosh Very compatible .
Interactive mode : The support of interactive mode , You can input the execution code from the terminal and get the result language , Interactive test and debug code snippets .
portable : Based on its open source features ,Python It's been transplanted ( That is to make it work ) To many platforms .
Scalable : If you need a piece of critical code that runs fast , Or I want to write some algorithms that don't want to be open , You can use C or C++ Complete that part of the program , And then from your Python Call in program .
database :Python Interface to all major business databases .
GUI Programming :Python Support GUI Can be created and ported to many system calls .
Embeddable : You can take Python Embedded in C/C++ Program , Let users of your program get " scripting " The ability of .
Python Of 3.0 edition , Is often referred to as Python 3000, Or abbreviation Py3k. be relative to Python Early versions , This is a big upgrade . In order not to bring too much burden ,Python 3.0 There is no downward compatibility in the design . Many are aimed at early Python No version of the program can be found in Python 3.0 On normal execution .
To take care of existing programs ,Python 2.6 As a transitional version , Basically used Python 2.x The grammar and the library , At the same time, the direction Python 3.0 Migration , Allow the use of parts Python 3.0 The syntax and functions of . new Python The program is recommended to use Python 3.0 The syntax of the version . Unless the execution environment is unable to install Python 3.0 Or the program itself does not support Python 3.0 Third party library . Currently not supported Python 3.0 The third-party library of Twisted, py2exe, PIL etc. .
Most third-party libraries are trying to be compatible Python 3.0 edition . Even if it's not immediately available Python 3.0, It is also recommended to write compatible Python 3.0 Version of the program , And then use Python 2.6, Python 2.7 To execute .
Python 3.0 The changes are mainly in the following aspects :
print The sentence is gone , In its place print() function .
Python 2.6 And Python 2.7 Partially support this form of print grammar .
Python 2 Yes ASCII str() type ,unicode() It's alone , No byte type .
Now? , stay Python 3, We finally have Unicode (utf-8) character string , And one
Byte classes :byte and bytearrays.
because Python3.x The source file defaults to utf-8 code , So it is more convenient to use Chinese :
Python Division in is very high-end compared with other languages , There's a complex set of rules .
Python Division in has two operators ,/ and //
First of all / division :
stay Python 2.x in / Division is like most languages we are familiar with , such as Java and C , The result of integer division
It's an integer , Ignore the decimal part completely , Floating point division keeps the decimal part to get the result of a floating point number .
stay Python 3.x in / Division doesn't do that anymore , For the division between integers , The result will also be floating-point numbers .
And for // division
This division is called floor division , The result of division will be automatically given a floor operation
stay Python 2.x and Python 3.x Is the same .
stay Python 3 The exception handling in has also slightly changed , stay Python 3 We now use as As a key word .
The syntax for catching exceptions is except exc, var Change it to except exc as var.
Octal numbers must be written as 0o777, The original form 0777 It's not working ; Binary must be written as 0b111.
I added a new one bin() Function to convert an integer to a binary string . Python 2.6 Both grammars have been supported .
stay Python 3.x in , There is only one way to represent octal literals , Namely 0o1000.
Python 2.x There are not two ways of writing != and <>
Python 3.x Removed from <>, Only != A way of writing .
python Code blocks use indentation limits , stay 2.0 The series version supports spaces and tab Keys are used together
The rule is 1tab=8 Space , stay 3.0 This syntax is removed from , Use tab Key strictly restricts the code format .
There are many differences that bloggers have not introduced , If you are interested, you can collect it online .
Python It is a language that interprets while executing , So the operation efficiency is a little low , But for the user experience , Generally, I can't feel . Follow up bloggers will be guided by the heart from entry to mastery , Keep updating in this column python Some excellent bags . Welcome to like and subscribe . If you are interested, you can also consult bloggers in the comment area .