程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[basic Python tutorial] self introduction of Python language

編輯:Python

List of articles

  • Self introduction
  • One 、Python Development history of
  • Two 、Python The characteristics of
    • 1. Language features
    • 2. Grammatical features
  • 3、 ... and 、Python2 And Python3 Comparison
    • 1.print function
    • 2.Unicode
    • 3. Division operations
    • 4. abnormal
    • 5. Octal literal means
    • 6. Inequality operator
    • 7.python 3.0 Strictly use tab Key to indent
  • Four 、Python Applicable to development scenarios and achievements
    • 1. Application field
    • 2.Python Developed applications
  • summary


Self introduction

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 .
ψ(*`ー´)ψ


One 、Python Development history of

Time Trends 1989 year Jim · Van rousum to pass the time , Decided to write an interpreter for a new scripting language that was being conceived at the time . As a fan of parson , He is in Python Name the project , Use C Development .1991 year Released in Python The first version of . here Python Already has class , function , exception handling , Core data types including tables and dictionaries , And module based expansion system .1991-1994 year ,Python Added lambda,map,filter and reduce1999 year Python Of web The father of frame ——Zope 1 Release .2000 year Python 2.0 On 2000 year 10 month 16 Promulgated by the , The memory recycling mechanism is added to form the present Python The foundation of language Framework 2004 year web frame Django Be born 2006 year Python 2.5 Series release 2008 year Python 2.6 Series release 2010 year Python 2.7 Series release 2008 year Python 3.0 On 2008 year 12 month 3 Promulgated by the , This version is not fully compatible with previous versions Python Source code . however , Many new features were later transplanted to the old ones Python 2.6/2.7 edition .2009 year Python 3.1 Series release 2011 year Python 3.2 Series release 2012 year Python 3.3 Series release 2014 year Python 3.4 Series release 2015 year Python 3.5 Series release 2016 year Python 3.6 Series release 2018 year Python 3.7 Series release 2019 year That year 10 month Python 3.8 Release 2020 year Official announcement ,2020 year 1 month 1 Japan , stop it Python 2 Update .10 month 5 Number 3.9 Version release 2021 year 10 month 4 Japan Python 3.10 Version release at present Move to a higher version , But I'm accepting Microsoft Reactor In an interview ,Van Rossum Asked Python The future of , And when it will happen Python 4.0. But he said , Maybe not Python 4 了 .
 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 .

Two 、Python The characteristics of

1. Language features

  • 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 .

2. Grammatical features

  • 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 .

3、 ... and 、Python2 And Python3 Comparison

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 :

1.print function

print The sentence is gone , In its place print() function .
Python 2.6 And Python 2.7 Partially support this form of print grammar .

2.Unicode

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 :

3. Division operations

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 .

4. abnormal

 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.

5. Octal literal means

 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.

6. Inequality operator

Python 2.x There are not two ways of writing != and <>
Python 3.x Removed from <>, Only != A way of writing .

7.python 3.0 Strictly use tab Key to indent

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 .

Four 、Python Applicable to development scenarios and achievements

1. Application field

  • Cloud computing : The hottest language of Cloud Computing , Typical applications OpenStack
  • WEB Development : Many excellent WEB frame , Many large websites are Python Development 、YouTube、Dropbox、Douban…… Typical Web The framework includes Django
  • Scientific computing and artificial intelligence : A typical library NumPy、SciPy、Matplotlib、Enided The library 、 Panda
  • System operation and maintenance : Basic language of operation and maintenance personnel
  • Finance : Quantitative trading 、 Financial analysis , In the field of financial engineering ,Python Not only is it used most , And the most used , Its importance has increased year by year .
  • graphics GUI:PyQT,WXPython,TkInter

2.Python Developed applications

  • Youtube - Video social networking sites
  • Reddit - Social sharing sites
  • Dropbox - File sharing service
  • douban - The book 、 Record 、 Movie and other cultural products information database website
  • You know - A question and answer website
  • The nut - A pan science and technology theme website
  • Bottle - Python tiny Web frame
  • EVE - Network game EVE A lot of use Python Development
  • Blender - Use Python As a modeling tool and GUI Open source language 3D Drawing software
  • Inkscape - An open source SVG Vector graphics editor .

summary

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 .



  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved