First article: Python introduction

Source: Internet
Author: User
Tags php class

  

  Preface: As for Python small white, we need to know what Python is, why we learn python instead of other programming languages, what are the advantages compared to other languages, and how does the Python process work, and what are the classifications? The next step is to go into Python's world.

first, the definition of Python:

What is Python? Python is a programming language (script interpreter) developed by the famous ' Uncle Guido van Rossum ' in 1989 for Christmas in order to pass the boring Christmas.

Based on the 20,017 December Tiobe rankings-the popularity of programming language, Python overtook C #, PHP ranked fourth.

    

And all along, Python is on the rise, more and more people use the Python programming language, gradually more widely recognized by the industry.

2, the characteristics of Python:

So what are the characteristics of Python's rapid development?

  Let's talk about its advantages:---> ' elegant, clear, simple '.

    A, very good readability. and because Python uses forced indentation, it makes the code extremely readable.

    B, simple. --perfect for learning, similar to using certain rules to write English articles, and allows you to focus on the use of language to solve problems instead of obsessing over the language itself.

    C, Open source. --to put it simply, you are free to publish copies of the software, read its source code, make changes to it, and use it as part of the new free software.

    D, portability . and because of its open source nature, Python has been ported to many platforms (it has been modified to 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, QNX, VMS, Windows CE, and even PocketPC, Symbian and Google Linux-based Android platforms!

    E, supports both process-oriented programming and object-oriented 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. Java, C + +, etc. are difficult to implement.

    f, a rich library . -->python can be used with a defined third-party library. 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.

    g, extensibility, 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 also embed python in your C/C + + program to provide scripting functionality to your program users.

  Of course, Python also has its drawbacks:

1, the speed of operation is slower than other languages . --"because of its running time required to compile side of the process of execution, it is relatively slower than C, Java, PHP and so on.

    2,the open source of the Py Thon makes the Python language can not be encrypted. --" but the current domestic market is purely by writing software to sell to customers less, the website and mobile applications do not need to give the customer source code, so this problem is the problem." With the passage of time, many domestic software companies, especially game companies, have also begun to scale using him.

so, with respect to C, Java, PHP and other programming languages, what is the merits of Python?

C language: First of all we need to know that Python is implemented in C language.

        C language for the compiled language-"code compiled to get the machine code, machine code on the CPU directly executed." So it runs fast.

        Whether Python is a compiled or interpreted type is not clear, but an explanatory type. ---code compiles the bytecode, and then the virtual machine executes the bytecode into the machine code, which is then executed by the CPU.

    Compared to Java, PHP, C #, etc.:

PHP class: For writing Web pages, its limitations are very obvious.

Python and Java: Can write Web pages, can also write background functions, the two comparison-the former development efficiency is high, the implementation of low efficiency, or the development efficiency is low, execution efficiency is high.

3. Types of Python:
    • Cpython
      The official version of Python, implemented using the C language, is the most widely used, and the CPython implementation converts the source file (py file) into a bytecode file (PYc file) and then runs on the Python virtual machine.
    • Jyhton
      Python Java implementation, Jython will dynamically compile Python code into Java bytecode, and then run on the JVM.
    • IronPython
      In Python's C # implementation, IronPython compiles Python code into C # bytecode and then runs on the CLR. (similar to Jython)
    • PyPy (Special)
      Python implements Python, which compiles Python bytecode bytecode into machine code.
    • Rubypython, Brython.

4. Python Application fields:
    • System programming

    The Python language is a built-in interface for the operating system, called the shell tool. Python programs can search for files and directory trees, run other due programs, or work in parallel with processes or threads. The Python standard library binds POSIX and other general operating system tools. So environment variables, pipelines, processes, multithreading, files, sockets, Python regular expression pattern matching, command-line arguments, standard stream interfaces, Shell command initiators, file extensions, and so on. In addition, many Python system tools are designed with portability in mind.

    • Web crawler

    Python is often used to implement web crawlers because of its powerful network features. Common frameworks are:

grab– Web crawler Framework (based on Pycurl/multicur).

scrapy– Web crawler framework (based on twisted), Python3 is not supported.

pyspider– a powerful reptile system.

cola– a distributed crawler framework.

Portia– is based on scrapy visual crawler.

The HTTP Resource kit for Restkit–python. It allows you to easily access HTTP resources and create objects around it.

Demiurge– is based on the Pyquery crawler micro-frame.

    • Artificial Intelligence, Scientific computing

    Scientific computing, Artificial intelligence: Typical library numpy, SciPy, matplotlib, Enthought Librarys,pandas

    • Web Development

    Python has a number of excellent web frameworks, many large web sites are Python development, Youtube, Dropbox, watercress and so on typical web framework Django, flask, etc., enjoy learning class is using Django developed.

    • System operation and Maintenance

    Python has become the essential language for OPS, especially in Linux operations, which are basically automated operations.

    • Big data, cloud computing

    Python is the hottest language for big data, cloud computing, and typically OpenStack

    • Financial aspects

    Quantitative trading, financial analysis, in the field of financial engineering, Python is not only used, and used the most, but also the importance of increasing year by year. Reason: As a dynamic language Python, the language structure is clear and simple, the library is rich, mature and stable, scientific calculation and statistical analysis are very strong, production efficiency is much higher than c,c++,java, especially good at strategy backtesting.

    • Graphical interface aspects

    PyQT, Wxpython,tkinter

    • Case aspects of the enterprise and the website   

   Google: Google App Engine, code.google.com, Google Earth, Google crawlers, Google ads and other projects are heavily used in Python development

CIA: The US CIA website was developed in Python.

NASA: NASA uses Python for data analysis and computation

YouTube: The world's largest video site, YouTube, is developed in Python

Dropbox: The largest online cloud storage site in the United States, all implemented in Python, each day the site handles 1 billion files upload and download

Instagram: The largest image-sharing social network in the United States, with more than 30 million photos shared every day, all developed in Python

Facebook: A large number of base libraries are implemented in Python

Redhat: The Yum Package management tool in the world's most popular Linux distribution is developed in Python

Watercress: Almost all of the company's business is developed through Python

Know: The largest question and answer community in the country, through the development of Python (foreign Quora)

Wait a minute.

4, the installation of Python

  There is also the knowledge about the installation of Python,

Installation of Python on Windows--"refer to https://jingyan.baidu.com/article/574c52197b9fbc6c8c9dc170.html# #1

Installation of python3.x under Linux can be followed by the following process:

1 #Download the python3.x installation package2wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5. tgz3 #preparatory work4Yum Install gcc-* glibc-*-y5 #switch to the directory where the package is installed and unpack6TAR-XVF Python-3.6.5. tgz7 #switch to the unpacked directory, run the Configure script, add the compilation parameters8./configure--prefix=/usr/local/python3.69 #compilingTen  Make One #installation AMake install

To add an environment variable:

# Locate the python3.x installation, modify the configuration file vim/etc/profile # Add the python3.x installation directory to the back of the path Path =/usr/local/bin:/usr/bin/.......:/usr/local/python 3.6export Path

In the case of Python2. Install---Linux the default installation is for python2.x to run directly.

    

First article: Python introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.