Life's not worth it, I'm using python.1_ about Python

Source: Internet
Author: User

  Always like programming, recently decided to concentrate into the pit. At first, have been studying what language to learn, think C language, learn VB (two days ... ), and later heard of Python, powerful, and suitable for small white start. Writing is not good, but still applied for the blog number, in order to record, to publish their own thinking, I hope that the days ahead can adhere to the present enthusiasm, to achieve their desired height. Come on!

————————————————————————————————————————————————————

About Python

Introduction:

 Python is an object -oriented , dynamic, High-level computer programming language , with the Dutch Guido van Rossum invented in 1989, The first public release was released in 1991.

Python is purely free software, and the source code and interpreter CPython follow the GPL protocol . Python syntax is simple and clear, one of the features is to force the statement indentation with whitespace characters.

Python has a rich and powerful library. It is often nicknamed the Glue language and can be used to connect various modules (especially C + +) made in other languages. A common application scenario is to use Python to quickly build a prototype of a program that can be rewritten in other languages if there are other specially requested parts.

2018 Release 3.x, in March, the official announced that Python2.7 will terminate its support on January 1, 2020. Users who wish to continue to receive Python2.7-related support after this date will be charged to the commercial vendor.

Features: Advantages

  Simple: Python is a language that represents the idea of simplicity. Reading a good Python program feels like reading English. It allows you to focus on solving problems rather than figuring out the language itself.

  easy to learn: Python is extremely easy to get started because Python has a very simple documentation.

  fast speed: The bottom of Python is written in C, and many standard libraries and third-party libraries are written in C and run very fast.

  free, open Source: Python is one of the floss (free/open source software). The user is 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. Floss is the concept of sharing knowledge based on a group.

  High-level languages: When writing programs in the Python language, you don't have to consider the underlying details such as how to manage the memory used by your program.

  portability: Because of its open source nature, Python has been ported on many platforms (modified to make it work on different platforms). 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, PocketPC, Symbian, and Google Linux-based Android platforms.

  Explanatory: A program written in a compiled language, such as C or C + +, can be converted from a source file (that is, C or C + +) to a language used by your computer (binary code, 0 and 1). This process is done through the compiler and different tags and options. When you run the program, the connection/reprint software copies your program from the hard disk into memory and runs. Programs written in the Python language do not need to be compiled into binary code. You can run the program directly from the source code. Inside the computer, the Python compiler translates the source code into an intermediate form called bytecode, and then translates it into the machine language used by the computer and runs it. This makes it easier to use Python. It also makes Python programs easier to migrate.

  Object-oriented: Python 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.

  Extensibility: If you need a piece of critical code to run faster or you want some algorithms to be private, you can write some programs in C or C + + and then use them in a Python program.

  embeddable: python can be embedded in a C + + program to provide scripting functionality to program users.

  a rich library: The Python standard library is really huge. It can help 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. 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.

  code for the specification: Python uses forced indentation to make your code more readable. Programs written in the Python language do not need to be compiled into binary code.

Disadvantages

  single-line statements and command-line output problems: Many times you cannot write a program to a line, such as import sys;for I in Sys.path:print i. Perl and awk do not have this limitation, it is easier to complete a simple program under the shell, do not need to like Python, the program must be written to a. py file.

  unique Syntax: This may not be referred to as limitation, but it is also confusing for many beginners by indenting the way in which the statement relationship is differentiated. Even the most experienced Python programmers can get caught up in a trap.

  Slow running: This is compared to C and C + +.

Application

System Programming: Provide API (Application programming Interface application programming Interface), can facilitate system maintenance and management, Linux under one of the iconic language, is the ideal programming tool for many system administrators.

    • graphics processing : PIL, Tkinter and other graphics library support, can be easily graphics processing.
    • Mathematical processing : The numpy extension provides a large number of interfaces to many standard math libraries.
    • Text Processing :p Ython provides a re-module that supports regular expressions, and also provides sgml,xml analysis modules, which many programmers use to develop XML programs using Python.
    • Database Programming : Programmers can communicate with Microsoft SQL Server,oracle,sybase,db2,mysql, SQLite, and other databases through modules that follow the Python DB-API (database application programming Interface) specification. Python comes with a gadfly module that provides a complete SQL environment.
    • Network Programming : Provides a wide range of modules to support sockets programming, enabling fast and easy development of distributed applications. Many large-scale software development programs such as zope,mnet and bit tottent. It is widely used by Google.
    • Web Programming : The development language of the application, supporting the latest XML technology.
    • Multimedia Applications :P Ython's Pyopengl module encapsulates the "OpenGL application Programming Interface" for two-and three-dimensional image processing. The Pygame module can be used to write game software.
    • Pymo engine :P Ymo is all called Python memories off and is a AVG game engine running on Symbian S60v3,symbian3,s60v5, Symbian3, Android. It is named Pymo because it is developed based on the python2.0 platform and is applicable to the AVG game that creates the memory of autumn (memories off) style.
    • Hacker Programming :p Ython has a hack library with built-in functions that you are familiar with or unfamiliar with, but lack the sense of accomplishment.
    • write a simple crawler in Python: first, you have to get the corresponding HTML source by urllib2 this module. (PS: After python3.3 urllib2 can no longer be used, instead of urllib) through the above three sentences will be able to url the source of the content variable, its type is character type. The next step is to extract the content we need from this stack of HTML sources. Use Chrome to see the code for the corresponding content (you can also use Firefox's Firebug). You can see that the information for the URL is stored in the span tag, and the information you want to get it can be used in regular style.
——— Extensions:

  Compiled Languages & interpreted languages

  Computers do not recognize high-level languages, and when we run high-level languages, we need a translator to turn the high-level language into a machine language that computers can read, and there are two ways to implement it:

One is compilation, the other is explanation.

Compiled language: Before the program executes, there is a separate compilation process that translates the program into machine language, which is no longer translated when the program is executed later.

Interpreted language: Translates the program into machine language at run time, so the speed is slower than the compiled language.

The former converts all the code into machine language at once and then writes the executable file. The latter is the first moment of the re-program operation, but also only the source program and no executable program, when the program every execution to the source program, there will be a shell called an interpreter to convert the source code into binary code for execution, in a word, is to constantly explain, execute, interpret, execute ... Therefore, the interpretive procedure is inseparable from the interpretation procedure.

In fact, the two have advantages and disadvantages, the former due to the speed of the program execution, the same conditions on the system requirements, so like the development of operating systems, large applications, database systems, and so on, the use of compiled language (c + +, Pascal/object, Pascal (Delphi), VB, etc.). Some Web scripts, server scripts, and auxiliary development interfaces This type of program uses an interpreted language (Java, JavaScript, VBScript, Perl, Python, and so on), which requires a low speed requirement and a requirement for compatibility with different system platform keys.

Now, due to the advantages and disadvantages of the two are broadly complementary, and with the development of design technology and hardware, both the compilation and interpretation of the boundaries are constantly becoming blurred. For example, Java is an interpreted language, but before execution has been pre-compiled, the generated code is between the machine code and Java source code, the intermediary code, run time by the JVM (Java's virtual machine platform, can be interpreted as an interpreter) to interpret the execution. It retains the high abstraction and portability of the source code and has completed much of the precompiled work on the source code, so it is much faster to execute than the "pure interpreter" program.

  Dynamic Language & statically-oriented language

Dynamic language: Determines the language of the data type at run time.    A type declaration is not required before a variable is used, and the type of the variable is usually the type of the value being assigned. For example: Python, Ruby, Perl, and so on.

Static language: The data type of a variable at compile time is defined, and most static type languages require that the data type be declared before the variable is used.    Example: C + +, Java, Delphi, C #, etc.

  

  (PS: Part of the content excerpt, rewritten in the network, because wading is not deep, according to individual understanding of the angle of the word, part of the content unavoidably wrong, hope to forgive! )

Life's not worth it, I'm using python.1_ about Python

Related Article

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.