Python - the undisputed king of elegance

Life is short, I learn Python - famous quotes

Everyone knows that Python is sought after because of its simplicity, simplicity, and strong scalability. However, are these the only advantages of Python?

No, there are many more.

Table of contents

father of python

Python learning and function

study

effect

simplicity

Python

 Java

C++

scalability

pip

Cpython

reptile


Please see, this is a programming language ranking

At present, Python has occupied the first place in the list, which is enough to prove the strength of Python

father of python

Guido van Rossum  was a Dutch computer programmer best known as the author of the Python programming language. In the Python community, Guido van Rossum is known as the "Benevolent Dictator (BDFL)", meaning that he still keeps an eye on the Python development process and makes decisions when necessary. He works at Google, where he spends half his time maintaining Python development. 

Python learning and function

study

Python is very extensive to learn, but getting started is relatively simple. 

effect

The purpose of python

1. Web development

The birth history of Python is earlier than that of the Web. Since Python is an interpreted scripting language with high development efficiency, it is very suitable for Web development.

Python has hundreds of web development frameworks and many mature template technologies. Choosing Python to develop web applications not only has high development efficiency, but also runs fast.

Commonly used web development frameworks are: Django, Flask, Tornado, etc.

Many well-known Internet companies use python as their main development language: Douban, Zhihu, Guoke.com, Google, NASA, YouTube, Facebook...

Due to the versatility of the background server, in addition to narrowly defined websites, the servers of many apps and games are also implemented in Python.

2. Web crawler

Many people's passion for programming begins with curiosity and eventually stagnates.

There is a technical gap between real guns and real development, and no one gives advice, and I don’t know what the current level can do? In this cycle of doubts, programming skills have stagnated, and crawlers are one of the best advancement directions.

Web crawling is a commonly used scenario for Python. Internationally, Google used the Python language extensively as the basis of web crawling in the early days, which drove the development of the entire Python language application. In the past, many people in China used collectors to search online content, but now it is much easier to collect online information with Python, such as:

Crawl product discount information from major websites to compare and obtain the best choice;

Collect and classify speeches on social networks, generate emotional maps, and analyze language habits;

Crawl all the comments of a certain category of songs in NetEase Cloud Music to generate a word cloud;

Filter and obtain Douban movie and book information by condition and generate a table...

There are so many applications that almost everyone can use crawlers to do some fun, interesting and useful things after learning crawlers.

3. Artificial intelligence

Artificial intelligence is a very hot direction now, and the AI ​​boom has filled the future of the Python language with unlimited potential. Most of the several very influential AI frameworks released now are implemented in Python. Why?

Because Python has many libraries that are very convenient for artificial intelligence, such as numpy and scipy for numerical calculations, sklearn for machine learning, pybrain for neural networks, and matplotlib for data visualization. In the field of artificial intelligence, data mining, machine learning, neural network, deep learning and other aspects are mainstream programming languages, which are widely supported and applied.

Most of the core algorithms of artificial intelligence still rely on C/C++, because they are computationally intensive, require very fine optimization, and also require interfaces such as GPU and dedicated hardware, which only C/C++ can do.

And Python is the API binding of these libraries. Python is used because of the glue language feature of CPython. To develop a cross-language interface from other languages ​​to C/C++, Python is the easiest, and the threshold is much lower than other languages. Especially It's time to use Cython.

4. Data analysis

In terms of data analysis and processing, Python has a very complete ecological environment. For distributed computing, data visualization, database operations, etc. involved in "big data" analysis, Python has mature modules that can be selected to complete its functions. For both Hadoop-MapReduce and Spark, Python can be used directly to complete the calculation logic, which is very convenient for both data scientists and data engineers.

5. Automated operation and maintenance

Python is also very important for server operation and maintenance. Since almost all Linux distributions currently have their own Python interpreter, using Python scripts for batch file deployment and operation adjustment has become a very good choice for Linux servers. Python also contains many convenient tools, from paramiko for controlling ssh/sftp, to supervisor for monitoring services, to construction tools such as bazel, and even package management tools for C++ such as conan, Python provides a full range of tools On this basis, combined with the Web, it will become very simple to develop tools that are convenient for operation and maintenance.

6. Examples of other applications of Python

System programming: Provide API, which can facilitate system maintenance and management. It is one of the iconic languages ​​under Linux and is an ideal programming tool for many system administrators.

Graphics processing: Supported by graphics libraries such as PIL and Tkinter, it is convenient for graphics processing.

Mathematical processing: NumPy extensions provide extensive interfaces to many standard math libraries.

Text processing: The re module provided by Python can support regular expressions, and also provides SGML and XML analysis modules. Many programmers use Python to develop XML programs.

Database programming: Programmers can communicate with databases such as MicrosoftSQLServer, Oracle, Sybase, DB2, MySQL, and SQLite through modules that follow the PythonDB-API (Database Application Programming Interface) specification. Python comes with a Gadfly module that provides a complete SQL environment.

Network programming: Provide rich modules to support sockets programming, which can facilitate and quickly develop distributed applications. Many large-scale software development projects such as Zope, Mnet and BitTorrent.Google are using it extensively.

Web programming: application development language, supports the latest XML technology.

Multimedia application: Python's PyOpenGL module encapsulates the "OpenGL application programming interface", which can perform two-dimensional and three-dimensional image processing. The PyGame module can be used to write game software.

Hacker programming: Python has a hack library, which has built-in functions you are familiar with or unfamiliar with, but lacks a sense of accomplishment.

simplicity

This feature is what Python is most talked about by people. The following is the code to print "Hello, world." in Python, Java and C++

Python

print("Hello,world.")

 Java

class MyFile{
    public static void main(String[],args){
        System.out.print("Hello,world.");
    }
}

C++

#include <iostream>
using namespace std;
 
int main()
{
    cout<<"hello world"<<endl;
 
    return 0;
}

Obviously, Python is undoubtedly the most concise.

scalability

I think the strongest thing about Python is its extreme scalability

pip

Anyone who has studied Python knows how easy pip is. You can use pip install + third-party library name to download any public Python third-party library just by connecting to the Internet. You don’t need to manually download and configure it like other languages.

Cpython

This is something that a Python novice does not know. Python is actually written in C++. That is to say, you can directly call C and C++ codes in Python. At present, there are many third-party libraries written in C and C++. of

reptile

How can you talk about Python without talking about crawlers? What are crawlers?

Answer: A web crawler (also known as a web spider, a web robot) is a program that simulates a browser to send web requests and receive request responses. It is a program that automatically grabs Internet information according to certain rules.
In principle, as long as the browser (client) can do anything, the crawler can do it.

In fact, all programming languages ​​​​can implement crawlers, but because Python is concise and elegant, basically crawlers are implemented by Python.

Reptiles: Reptiles, anti-reptiles, and anti-reptiles all actually exist.

import requests
# 导入库

url = ’https ://www.baidu.com/’
response = requests . get ( url = url )
page_text = response . text
with open (’sogou . html ’,’w’, encoding =’utf -8’) as fp:
fp . write ( page_text )
print ("OK")

This is reptiles.

Guess you like

Origin blog.csdn.net/gxlcf_516312/article/details/126528345