1-1, Python introduction:
Python is a high-level programming language for interpreting, object-oriented, and dynamic data types. Python was invented by Guido van Rossum at the end of 1989, and the first public release was released in 1991. Like the Perl language, the Python source code also follows the GPL (GNU general public License) protocol.
Python (United Kingdom pronunciation:/?pa?θ?n/American pronunciation:/?pa?θɑ?n/) is an object-oriented, interpreted computer programming language, invented by Dutch Guido van Rossum in 1989, and the first public offering was released in 1991.
Python is purely free software, and the source code and interpreter CPython follow the GPL (GNU general public License) agreement. Python syntax is simple and clear, and one of the features is to force whitespace (white space) to be indented as a statement.
Python has a rich and powerful library. It is often nicknamed the glue language and is able to easily connect a variety of modules made in other languages, especially in C + +. A common application scenario is to use Python to quickly build a prototype of a program (sometimes even the final interface of the program) and then rewrite it in a more appropriate language, such as a graphics rendering module in a 3D game, with a particularly high performance requirement, and can be rewritten in C + + with a specially requested part. It is then encapsulated as an extension class library that Python can call. It is important to note that you may need to consider platform issues when you use the Extended class library, and some may not provide cross-platform implementations.
TIOBE Index Rank:
The TIOBE Programming Community index was founded and maintained by the TIOBE company of the Dutch Eindhoven. TIOBE stands for "The importance of sincerity", which ranks each language as a keyword, according to the number of search engine queries. Because TIOBE only indexes the full language of Turing, SQL and HTML are not taken into account. The November 2016 rankings showed that Java remained the most popular language, followed by C and C + + rankings. Surprisingly, the Visual Basic and Python rankings have risen sharply, side-by-front Javascript, and assembly language has been squeezed into the top ten:
PYPL Rankings:
The PYPL (programming language prevalence index) is counted based on Google's search frequency for language tutorials. Java is still a big winner in terms of global search engine popularity, with Python up 6.8% from the previous five years and PHP plunging 5%.
1-2. The advantages of the Python language:
Advantage One: as 0 basis non-trained, Python syntax is simple and suitable for us to read. Python itself is a scripting language, easy to understand, Python's pseudo-code essence is one of its greatest advantages.
Advantage Two: easy to learn, Python gives up the very complex pointers in C, simplifying the syntax of Python.
Advantage Three: Python supports both process-oriented function programming and object-oriented abstract programming. In a process-oriented language, a program is built from a procedure or simply a function of reusable code. In object-oriented languages, programs are built from objects that combine data and functionality. Python implements object-oriented programming in a very powerful and simple way, compared to other major languages such as C + + and Java.
Advantage Four: The Python standard library is really huge. Python has a definable third-party library that can be used. It can help you with all kinds of work, including regular expressions, document generation, unit tests, threads, databases, Web browsers, CGI, FTP, e-mail, XML, XML-RPC, HTML, WAV files, cryptography systems, GUI (graphical user interface), TK, and other system-related operations. Remember that all of these features are available as long as Python is installed. This is called Python's "fully functional" concept. In addition to the standard library, there are many other high-quality libraries, such as Wxpython, twisted, and Python image libraries, and so on.
Advantage Five: scalability and embeddable. If you need a piece of your critical code to run faster or you want some algorithms to be private, you can write some of your programs in C or C + + and then use them in your Python program. You can embed python in your C/C + + program to provide scripting functionality to your program users.
Advantage Six: because of its open source nature, Python has been ported on many platforms (modified to make it work on different platforms). If you are careful to avoid using system-dependent features, all your Python programs can run without modification on any of the platforms listed below. These platforms include Linux, Windows, FreeBSD, Macintosh, Solaris, OS/2, Amiga, AROS, as/400, BeOS, os/390, z/OS, Palm OS, QNX, VMS, Psion, Acom RISC OS, VxWorks, PlayStation, sharp Zaurus, Windows CE and even PocketPC, Symbian, and Google Linux-based Android platforms.
1-3, Python environment installation:
Because Python is cross-platform, it can run on Windows, Macs, and various Linux/unix systems. Write a Python program on Windows and put it on Linux to run it.
To start learning Python programming, you first have to install Python on your computer. Once installed, you will get the Python interpreter (which is responsible for running the Python program), a command-line interaction environment, and a simple integrated development environment.
Choose 2.x or 3.x?
in the current environment, Python has two versions, One is the 2.x version, a 3.x version, many times we all use the 2.x version, now many tutorials are around the 2.x version of the Novice boot, but these two versions are incompatible, many grammar rules have a corresponding change, and now Python is evolving towards the 3.x version, in the evolution process, a large number of 2.x Version of the code to be modified to run, so there are currently many third-party libraries are temporarily unable to use on the 3.x. So, I am a 3.x version of the introduction, my notes are in accordance with the 3.x version to learn.
Windows:
1 First step: Download the installation file 2 https://www.python.org/getit/3 Step two: Install Python
4 Step three: Verify installation success
5 Open cmd, enter python-version, Python version appears, the installation is successful
Mac OS:
MacOS itself comes with Python2.7, if you want to use python2.x's small partners can be used directly, if you want to use python3.x's small partner, need to upgrade the system comes with Python2.7. The first step: Install Homebrew homebrew,homebrew short brew, is Mac OSX software package management tool, can be conveniently installed in the Mac or uninstall software, you can say Homebrew is the Mac apt-get, yum artifact Homebrew installation is very simple, open the terminal copy, paste the following command, enter, done (please rest assured that the original official installation method handling) Ruby -E"$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"homebrew commonly used: $ brew Search<pkg_name>#Find Packages$ Brew Install <pkg_name>#Install packages$ brew List#List Packages$ brew Uninstall <pkg_name>#Uninstalling Packages$ Brew Update#Update$ Brew Info <pkg_name>#View basic information about a packageStep Two: Install Python enter the following command in the terminal: Brew Install Python3 (PS: Can add sudo to the front if something goes wrong)
Step three: Add Python to Path $ nano~/. Bash_profile Export PATH=/usr/local/share/python: $PATH
Fourth step: Check if the installation is successful which Python to see the installation location. After the installation is complete, type Python in the terminal to verify that the installation was successful.
Fifth step: Install Pip mac inside Python comes with Easy_install, the fastest should be in terminal inside sudo easy_install pip, network for several seconds OK. Run finish can use PIP Help test whether the installation is successful, after successful installation, direct PIP install NumPy or its XX (package name) on it. PS: Use sudo when you need to enter a password, this password is your own computer password, entered the time to take a "confidential measures", you do not see the characters you entered, the full input after the return on it.
Linux:
Linux default system comes with python2.7 version, this version is dependent on many system programs, so it is not recommended to delete.
If you use the latest Python3 then we know that there is no impact between the compiled and installed source package and the system default package, so you can install Python3 and python2 coexistence the first step: Download the installation file first go to the Python official website download Python3 source package, Website: HTTPS :www.python.org/, select the Linux (32/64) bit source package.Step Two: Unzip the file tar-xvzf Python-3.6.1. tgz Step Three: Create the path to the installation file. mkdir/usr/local/Python3 Fourth Step: Compile./configure--prefix=/usr/local/Python3 Fifth Step: Install make made install step sixth and create a new version of the soft connection. 1, modify the old version MV/usr/bin/python/usr/bin/Python_bak2, create a new soft connection ln-s/usr/local/python3/bin/python3/usr/bin/python3, check python version python-V python-3.6.1seventh Step, after the configuration is successful, configure the PIP31, path= $PATH: $HOME/Bin:2, path= $PATH: $HOME/bin:/usr/local/python3/bin
1-4, the first experience of Python charm:
Output the first line of Python code:
Enter Python in cmd, enter in Python edit mode, and type in the first line of code:
1 Print ("hello,python! ")
Operation Result:
At this point, our Python environment has been fully installed to make our Python learning experience a journey.
Life is short, I use python!
Python 0 Basic Learning Series II--python Introduction and environment construction