[Base] _1 Python Python Introduction

1 Python Introduction

Python is a computer programming language . Is a dynamically typed object-oriented language, originally designed for writing automated scripts (shell), constantly updated with the addition of new features and language versions, is used more and more independent, large-scale development projects.

History of the development of 1.1 Python

1989 Christmas Dutchman Guido van Rossum (Guido van Rossum), is to pass the boring holiday, the development of new script interpreter, as a succession of ABC language, Python (boa constrictor) from the United Kingdom in the 1970s premiere of the television comedy "Monty. Parsons's flying circus" (Monty Python's flying circus).

1991 years, the public offering of the first version of Python.

October 16, 2000, released Python 2, stable version of Python 2.7, since after 2004, Python usage increases linearly.

December 3, 2008, public offering of Python 3.0, which is a major upgrade, in order to avoid introducing historical burden, not fully compatible with Python 2, resulting in a long time Python 2 users reluctant to upgrade to Python 3.0 this split once influenced Python applications.

June 2009, Python version 3.1 released.

January 2011, Python is TIOBE list of programming languages ​​named the 2010 language. Python has rapidly risen to No. 4, behind Java, C, C ++. Java server application development accounted for the vast majority of electricity providers, finance, communications and so on in the world, and C, C ++ programming hardware accounted for most of the world close to the operating system, it's hard to shake the status of the three languages.

February 2011, Python version 3.2 released.

September 2012, Python version 3.3 released.

March 2014, Python version 3.4 released.

September 2015, Python version 3.5 released.

December 2016, Python 3.6 released version.

March 2018, the language of the announcement on the mailing list Python 2.7 will end support 2020 January 1. If you want to continue to be relevant to user support and Python 2.7, need to pay to commercial providers.

Currently Python has been widely used in large data , artificial intelligence (AI), Professor programming courses, computer vision library OpenCV , three-dimensional visualization library VTK, medical image processing library ITK, NumPy, SciPy, matplotlib, engineering technology, researchers deal with experimental data, charting, develop scientific computing applications, etc.

The difference between 1.2 programming language

(1) interpreted language: Python and PHP

Advantages: better portability, as long as the interpretive environment, may be run on different operating systems;

Cons: Run the need to explain environment, running slower than compiled, resource-intensive, low efficiency of the code, you can run the code modification, maintenance quick and easy;

(2) compiled languages: C, C ++, Java

Advantages: speed, high code efficiency, the compiled program can not be modified, preferably confidentiality;

Cons: code needs to be compiled before running, poor portability, only run on a compatible operating system;

1.3 Python language features

(1) easy to learn: the Python relatively few keywords (33), a simple structure, tend to "only one of the best way to work," abandoned complex algorithms C, C ++ pointer (such as: We need 100 lines of code in Java, but in Python may only need 20 lines of code)

(2) object-oriented: functions, modules, numbers, strings are objects (C, C ++ oriented processes). And fully supports inheritance, overloading, derived, multiple inheritance, enhance the beneficial reuse of source code. Python supports overloaded operators and the dynamic type. Lisp relative to the traditional functional programming language, Python for functional design offers only limited support. There are two standard library (functools, itertools) provided Haskell and Standard ML proven in functional programming tool.

(3) Scalability:

① syntax clear: It is not even a format of freedom languages ​​(eg: it requires next line if statement must be indented to the right, otherwise it will not compile)

② built-in modules: Python scripting language has the most rich and powerful class libraries (those libraries are aptly called "batteries included, built-in battery"), these libraries covering file I / O, GUI, network programming, database Most of access scenarios, text manipulation.

③ program call: If you need to run some critical code quickly or want to write some algorithms you do not want to open that part of the program can be done in C or C ++ and then call from the program.

(4) Cross-Platform: Python as an interpreted language, which is inherently a characteristic cross-platform, as long as the corresponding Python interpreter platform, Python can run on that platform. (Interpreted language is almost natural cross-platform. On Windows, Unix and Linux has a very good compatibility)

(5) Easy maintenance: compile and run together, the source code can be run directly modified

(6) database: Python provides an interface to all major commercial databases

(7) GUI Programming: GUI (Graphical User Interface, referred to as GUI, also known as a graphical user interface ) is a graphical display of the computer operation the user interface . Early computer using the command line interface as compared to the graphical interface for the user to visually more acceptable on. It supports a very rich graphical development interface (pyqt, tkinter, pygame)

(8) Easy migration: As long as there is an interpretive environment can run on different operating systems (Linux, Windows, Mac)

(9) Interactive: presence information for handling the interaction between the operator and the system. Operator through a terminal device (see Input Output System Input) and the operation command information, to the system immediately after processing, and displays a processing result by the terminal device. print ( "hello python")

(10) open source license: Python source code to follow the GPL (GNU General Public License) protocol (universal public license)

(11) Python Cons:

① Slow: Python programs is slower than the operating efficiency of Java, C, C ++ and other programs (computer hardware faster and faster, software engineering tend to be more concerned about the development process efficiency, rather than operating efficiency, another key modules available C / C ++ to write Code, Python can call)

② source code encryption difficult: Unlike a compiled language source code is compiled into an object program, Python source code to run directly, and therefore more difficult to source code encryption. (Now the software industry trend has always been open, just like Java programs is also easy to decompile, but does not affect its popularity)

1.4 Python installation environment

Environmental variables (environment variables) generally refers to the number of parameters used to specify the operating environment of the operating system in the operating system, such as: temporary folder location and system folder location.

Environment variable is an object in an operating system with a particular name, it contains one or more application programs will use the information. Such as Windows and DOS operating system path environment variable, when the system is required to run a program and it does not tell the full path where, in addition to the system in the current directory to find this program below, we must also specify the path to the path to find . Users by setting environment variables to better run the process.

(1) official website: https://www.python.org

(2) Python in two versions: Python3.6 and Python2.7

① similarities and differences: only 0.3% is not the same, print () and print ""

② Note: There is a little difference between 2.7 and 3.6 syntax, available tools will be upgraded to 3.6 2.7

(3) the environment variable configuration: Python Python To be added to the configuration environment variable during installation, so you open the default 2.7 to 3.6 then the environment variable path Python2.7 added to the system if you want to use by default in the terminal the system environment variables in the final with a semicolon and then go in the path of the assignment.

(4) Python editor:

①PyCharm: is a Python IDE , with a set that can help users to use Python tools to improve their efficiency when language development, such as debugging , syntax highlighting , Project Management , the code jumps , IntelliSense , auto-complete , unit testing , version control . In addition, the IDE provides several advanced features , support for the Django framework under professional Web development .

②Vim: Vim is similar to a Vi of the famous and powerful, highly customizable text editor , improve and increase the number of features on the basis of Vi. VIM is a free software .

Vim is generally regarded as the class Vi editor, one of the best, in fact true rival Emacs from different variants. In 1999 Emacs is a text editor selected as a winner Linuxworld classification, Vim second place. But in February 2000, Slashdot Beanie Vim won the best open-source text editor award, in turn push Emacs to two lines, Overall, Vim and Emacs text editing are very good.

③Eclipse with PyDev:

④Sublime Text: is a code editor (Sublime Text 2 is billing software, but the trial indefinitely), also advanced HTML and prose text editor. Sublime Text is a programmer Jon Skinner in January 2008 as developed, it was originally designed as a Vim has a rich extension.

Sublime Text has a nice user interface and powerful features, such as code thumbnails, Python plug-ins, and other code segments. You can also customize the key bindings, menus and toolbars. The main features include Sublime Text: Spell checking, bookmarks, full Python API, Goto function, real-time project switching, multi select, multi-window, and so on. Sublime Text is a cross-platform editor that supports Windows , Linux , Mac the X-OS and other operating systems.

(5) Software installation (Python3.6 for example)

①Python3.6 installation (interpreter) https://www.python.org :

  • Check Add Python 3.6 to PAHT add the path to the interpreter environment variable, this can be implemented in a terminal and enter a command execution results;
  • Click Install Now to begin the installation until the installation is successful

②PyCharm installation (Editor) http://www.jetbrains.com/pycharm/

  • Click DOWNLOAD
  • Select the corresponding operating system (Windows, macOS, Linux)
  • Select the corresponding version ( Professional Professional Edition , Community Community Edition), where the election Pro (Professional Edition comes with many modules, ease of use)
  • Run the installation package, the installation directory is recommended installed in the other disk (C disc get stuck)
  • Checking the 32-bit launcher and .py, directly after the installation (to default)
  • Choose not to import the previous configuration I do not have a previous version of PyCharm or I do not want to import my settings
  • Product Activation screen, select License server, enter the activation address http://im.js.cn:8888 or http://idea.java.sx/ or http://xidea.online click Activate to activate the editor it can normally use

The direction of application of 1.5 Python

(1) Linux operation and maintenance

When Linux operation and maintenance must and we must grasp the Python language, Python is a very NB programming language that can satisfy the needs of Linux engineers work to improve efficiency, so as to enhance their own capacity, operation and maintenance engineers need their own independent development of a complete automation system this time is the real value of the expression.

(2) Python Web Site Engineer

Web presence has always been to be reckoned with, we can not do without the network, is inseparable from the Web

(3) Python automated testing

Python language help test is very large, the use of automated testing Python language is very broad, it can be said Python too strong, competence and familiarity with automated processes, methods, and we use each module

(4) Data Analysis

At present big data has arrived, the data can explain the cause of all the problems, many are now doing data analysis is not as simple as the original, Python language has become the first choice for data analysis, it also can bring great efficiencies to work

(5) Artificial Intelligence

Google made the robot, defeated the Go Master, and this is the current head of the newly hatched artificial intelligence, artificial intelligence course, our age has not yet come, if that day comes, life and the world will look very different, and now developing so fast, not too far from the era of artificial intelligence.

Guess you like

Origin www.cnblogs.com/liulian999/p/12045565.html