There may be some clickbait titles that are not specific to some specific applications and practices. What complement, inadequacy ask everybody to point out.

  1. What is Python? Life is short, You need python

Life is short. I use Python

Python is a high-level programming language with interpreted, object-oriented and dynamic data types. It has a mature and stable development history of more than 20 years. Python has the following features (from A Byte of Python) :

Simplicity: 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 the problem rather than figuring out the language itself.

L Easy to learn: Python is extremely easy to learn because Python has extremely simple.

L Free, open source.

High-level language: Writing programs in Python eliminates the need to worry about low-level details such as how to manage the memory your programs use.

Portability: Because of its open source nature, Python has been ported to almost all platforms (with changes to make it work on different platforms).

L Interpretative: The Python interpreter converts source code into an intermediate form called bytecode, which is then translated and run in the machine language used by the computer. This makes working with Python much easier. It also makes Python programs more portable.

L Object-oriented: Python supports both procedural and object-oriented programming. In a “procedural” language, programs are built from procedures or functions that are simply reusable code. In an “object-oriented” language, programs are built from objects that combine data and functionality.

L Extensibility: If you need a key piece of code to run faster or want certain algorithms to be hidden, you can write parts of your program in C or C++ and then use them in your Python program. (Glue language)

L Embeddability: Python can be embedded in C/C++ programs to provide scripting capabilities to program users.

L Rich libraries: The Python standard library is really big. It can help with a variety of tasks, including regular expressions, document generation, unit testing, threading, databases, web browsers, CGI, FTP, E-mail, XML, XML-RPC, HTML, WAV files, cryptosystems, GUIs (Graphical User interfaces), 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, to name a few. The front row is 762, the middle row is 459, and the back row is 510. Put the above three groups of letters together in order. She will arrange to learn.

Here are some key releases:

L In Amsterdam during The Christmas season of 1989, Guido decided to break the Christmas boredom by developing a new script interpretation program. He chose Python as his programming name because he was a fan of Monty Python’s flying circus.

clip_image002[4]

Founded by Guido van Rossum.

L Python 2.0 was released on October 16, 2000, mainly with full garbage collection and Unicode support.

L Python 3.0 was released on 3 December 2008. This version is not fully compatible with the previous Python source code.

The most widely used version is 2.7, and the latest stable version is Python 3.3.1 (April 6, 2013). Libraries like Django are starting to support Python3, which means Python3 is going mainstream.

Clip_image003 [4]

Figure: Philosophy of Python

Anyone who has worked with Python will probably know that typing import this into The interactive interpreter will display Tim Peters’ The Zen of Python. (From: Translation and Interpretation of The Zen of Python,

The Zen of Python, by Tim Peters

Beautiful is better than ugly.

Explicit is better than implicit.

Simple is better than complex.

Complex is better than complicated.

Flat is better than nested.

Sparse is better than dense.

Readability counts.

Special cases aren’t special enough to break the rules.

Although practicality beats purity.

Errors should never pass silently.

Unless explicitly silenced.

In the face of ambiguity, refuse the temptation to guess.

There should be one– and preferably only one –obvious way to do it.

Although that way may not be obvious at first unless you’re Dutch.

Now is better than never.

Although never is often better than right now.

If the implementation is hard to explain, it’s a bad idea.

If the implementation is easy to explain, it may be a good idea.

Namespaces are one honking great idea — let’s do more of those!

Translation and interpretation

Zen of Python by Tim Peters

Beautiful is better than Ugly (Python aims to write beautiful code)

Clear over obscure (elegant code should be clear, naming convention, and style similar)

Simplicity is better than complexity (elegant code should be concise, without complex internal implementations)

Complexity is better than clutter (if complexity is inevitable, don’t have complicated relationships between your code and keep your interfaces simple)

Flat is better than nesting (elegant code should be flat, not too much nesting)

Spacing is better than compactness (elegant code with proper spacing, don’t expect one line of code to solve the problem)

Readability is important (beautiful code is readable)

These rules should not be violated, even in the name of the practicality of the exception.

Do not include all errors unless you are sure you need to (catch exceptions precisely, do not write except:pass style code)

Don’t try to guess when there are multiple possibilities

Instead, try to find one, preferably the only, obvious solution (if in doubt, use exhaustive method)

It’s not easy, though, because you’re not the father of Python.

Doing may be better than not doing, but doing without thinking is better than not doing at all (think before you do)

If you can’t describe your plan to someone, it’s not a good plan. And vice versa (Scheme evaluation criteria)

Namespaces are a wonderful idea that we should make more use of.

  1. Example 1: Batch file renaming For example, replace “scroll_1” with “scroll_00” for all file names in the folder. If you do meet a good colleague, you’ll be lucky. Go ahead and learn. Python, PythonWeb, crawler, data analysis and other Python skills, as well as learning methods of artificial intelligence, big data, data mining, office automation and so on. Build from zero foundation to project development start combat all-round analysis!

Batch file renaming

import os

path = ‘C:\Users\tylerzhu\Desktop\icon’

for file in os.listdir(path):

if os.path.isfile(os.path.join(path,file))==True:

 newname = file.replace("scroll_1", "scroll_00")

    os.rename(os.path.join(path,file),os.path.join(path,newname))

    print(file)


Example 2: XML and Excel are converted from EXCEL to XML excel. Info_fight_monaster. XLS contains three sheets, which respectively represent the basic information, skill information and reward information of the monster.

clip_image004[4]

XML, info_fight_monster. XML contains all the information about the monster in the following format:

<monster attack=”84″ attrib=”2″ classId=”20″ define=”37″ desc=”” frameRate=”24″ icon=”cdn/imageres/pets/pet_56_20.png” Level =”4″ luck=”0″ monsterSID=”1024″ skill=”74″ Speed =”0″ strength=”447″ type=”0″ url=”cdn/flashres/pets/pet_20.swf”>

<skill skillLevel=”2″ skillSID=”30048″/>

<skill skillLevel=”2″ skillSID=”30034″/>

<prize desc=”” gameID=”0″ infoType=”27″ itemSID=”80001″ itemType=”0″ level=” name=”” num=”1″ plusSID=”400001″ prizeSID=”1″ type=”1″/>

</monster>

Write a script to convert Excel to XML.

Turn the Excel XML

! /usr/bin/env python

coding=utf-8

‘ ‘ ‘

Created on 2013-3-31

Convert info_Fight_monster. XLS to XML. The transformation is divided into the following steps:

Step1: Read the XML file, info_fight_monster.xls

Step2: parse the basic information of the monster, put it in the base sheet, and put it in an XML file

Step3: parse out the monster’s skill information and insert the skill information into the corresponding XML

Step4: parse out the monster’s reward information and insert it into the corresponding XML

Step5: save the XML file

@author: tylerzhu”’

from lxml import etree

import xlrd3, codecs

attrib = [“monsterSID”, “classId”, “type”, “level”, “attrib”, #

      "attack", "skill", "define", "speed", "strength", #

      "luck", "name", "desc", "icon", "url", "frameRate"];

     

prize = [“monsterSID”, “prizeSID”, “type”, “infoType”, “gameID”, “itemType”, #

     "itemSID", "num", "plusSID", "level", "name", "desc", "icon"];

    

skill = [“monsterSID”, “skillSID”, “skillLevel”];

info_fight_monster_xml = etree.ElementTree(etree.Element(“data”));

def openxls():

excel = xlrd3.open_workbook("xls/info_fight_monster.xls");

base = excel.sheet_by_name("base");

monster = excel.sheet_by_name("skill");

prize = excel.sheet_by_name("prize");

return (base, monster, prize);


def buildMonsterBase(xls):

sheet = xls[0]; for row in range(1, sheet.nrows): monsterAttr = {}; for col in range(0, sheet.ncols): if sheet.cell(row, col).value ! = None and col < len(attrib): monsterAttr[attrib[col]] = sheet.cell(row, col).value; if type(monsterAttr[attrib[col]]) == float: #print(str(round(monsterAttr[attrib[col]]))) monsterAttr[attrib[col]] = str(round(monsterAttr[attrib[col]])); sub = etree.SubElement(info_fight_monster_xml.getroot(), "monster", monsterAttr); sub.tail = "\n" #input()

def buildMonsterSkill(xls):

sheet = xls[1]; for row in range(1, sheet.nrows): skillAttr = {}; for col in range(1, sheet.ncols): if sheet.cell(row, col).value ! = None and col < len(attrib): skillAttr[skill[col]] = sheet.cell(row, col).value; if type(skillAttr[skill[col]]) == float: skillAttr[skill[col]] = str(round(skillAttr[skill[col]])); monsterSID = str(int(sheet.cell(row, 0).value)); monster = info_fight_monster_xml.find("*[@monsterSID='" + monsterSID + "']"); monster.text = ("\n\t"); sub = etree.SubElement(monster, "skill", skillAttr); sub.tail = "\n\t"

def buildMonsterPrize(xls):

sheet = xls[2]; for row in range(1, sheet.nrows): prizeAttr = {}; for col in range(1, sheet.ncols): if sheet.cell(row, col).value ! = None and col < len(attrib): prizeAttr[prize[col]] = sheet.cell(row, col).value; if type(prizeAttr[prize[col]]) == float: prizeAttr[prize[col]] = str(round(prizeAttr[prize[col]])); monsterSID = str(int(sheet.cell(row, 0).value)); monster = info_fight_monster_xml.find("*[@monsterSID='" + monsterSID + "']"); monster.text = ("\n\t"); sub = etree.SubElement(monster, "prize", prizeAttr); sub.tail = "\n\t"

def build():

xls = openxls(); buildMonsterBase(xls); buildMonsterSkill(xls); buildMonsterPrize(xls); Ouput = codecs.open('output/info_fight_monster.xml', 'w', 'utF-8 '); ouput.write(etree.tounicode(info_fight_monster_xml.getroot())) ouput.close();

if name == ‘__main__’:

build();

Isn’t that simple!

The following example converts the data of info_Fight_book. Xml to Excel format. The example contains only one sheet.

XML to Excel

! /usr/bin/env python

encoding=utf-8

‘ ‘ ‘

Created on 2013-5-6

Set the skill book info_fight_book. XML to Excel format.

The example contains only one sheet. If there are more than one sheet, the same is done.

@author: tylerzhu

‘ ‘ ‘

from lxml import etree

import xlwt3 as xlwt

Write excel title

.

wb = xlwt.Workbook()

Ws = Wb.add_sheet (” skill book “)

tree = etree.parse(‘.. /xls/info_fight_book.xml’)

root = tree.getroot()

row = 0

col = 0

for item in root:

if len(item.attrib) == 0:

    continue

row = row + 1

col = 0

for attr in item.attrib:

    ws.write(row, col, item.attrib[attr])

    col = col + 1


wb.save(‘.. /output/ skill book.xls ‘)

From the above examples, we can see that Python code has the following characteristics:

L The first line is a special form of comment: it’s called the organization line — the first two characters of the source file are #! “Followed by a program. This line tells your Linux/Unix system which interpreter it should run when you execute your program. This form is recommended – #! /usr/bin/env python instead of — #! The/usr/bin/python.

The l indent is important. Python uses indentation, rather than a pair of curly braces, to divide blocks of statements.

L Docstrings, __doc__, not much use. A good Python program, however, should have a docstring, and generally follows: “The convention for a docstring is a multi-line string that begins with an uppercase letter and ends with a period. The second line is blank, and starting with the third line is detailed description.”

L When a module is imported into Python, it must first execute the main block of the module. Of course, the module may be full of functions. If you want to avoid using the module name: from module name import symbol name, then use the symbol name without using the module name + dot + symbol name, but not recommended as it can make the program hard to read and error prone (especially given Python’s concise and simple syntax) import… as … Give an alias

The module’s __name__ attribute, which is quite useful, solves the drawback of import by not calling the main block if the module is not running

F = file(name, ‘w’), f.write(…) The same is true for reading files, f = file(name), f.read or readline, and then close

L…

  1. Why Python?

3.1. The future! Capital essence! clip_image006[4]

Photo: A few years ago, it was said that companies were using Python to raise the threshold for job-hopping.

The screenshot above is just 2 jokes :-). Anyway, now that Python is one of the most popular programming languages out there, don’t worry about it at all.

TIOBE Programming Language Of the Year 2007 and 2011.

clip_image007[4]

Figure: TIOBE Programming Language (2002~2012 Python Index)

PYPL (Popularity of Language Index), which takes a second look at the Popularity indicators of various languages. Over the past decade, Python has seen the biggest growth — the language of the decade. To help you on your way to learning Python, you can take a course from a Python expert. He has free live classes on the Internet at 8 PM every night. He will talk about Python in a very easy to understand and funny way. The greatest value of learning Python from a master is to listen to your words for ten years. The value of self-study is that it is better to study by yourself for half a year than to have a master teach you a day, 365 days a year. He will teach you every night, and there are students who like to listen to it. To his WeiXin * (in Chinese) : in the front row is: 762, in the middle of a row is: 459, the back of a set of is: 510, the above three group of letters can be combined in accordance with the order, very simple, Newton once said, standing on the shoulders of others, you will see higher and further, all rivers run into sea, to conquer the python world of the ocean.

clip_image008[4]

Figure: Programming language popularity index

3.2. Highly efficient Development It is said that Douban was launched in only 3 months. The development efficiency is high for the following reasons.

Rich built-in types and related operations clip_image010[4]

L String: the String is placed in single, double, or triple quotes (for multiple lines) and indexed from 0. Supported

N check: find, index,

N slice: S [0:2], S [1:]

N Connection: ABC + ef => abcdef, join

N Split: split

N Format: format

N… Case conversion, encoding and other operations

L list, [] : names=[” Dave “, “Mark”, “Ann”], list index from 0, index element names[1] Lists can contain objects of any type and can be nested. Supports adding, deleting, searching, and sharding.

N Add: insert, append

N Delete: del, remove, and pop

N check: search

N Slice: names[0:2], [1:]

N connection: [1,2,3]+[4,5] => [1,2,3,4,,5], extend

N Reverse: reverse

L tuple, () : address=(” www.python.org “, 80), a =(80,). Tuple syntax is similar to list in that it is equivalent to enumeration and can be null. If it contains only one element, a comma is required to distinguish it from the expression (” one “,). After a tuple is created, it cannot be replaced, deleted, or inserted. However, tuples are supported

N If the index is address[0], go to www.python.org

Address [0:] => (‘www.python.org’, 80)

N connection: (” www.python.org “) + (80,) = > (‘ www.python.org ‘, 80)

N host,port=address: host => www.python.org,port= > 80

Dict (), {} : address={“host”:”www.python.org”, “port”:80}, supported

N Index: address[” host “] => www.python.org,

N get: address.get(“host”) => www.python.org

N key: address.keys() => [‘host’, ‘port’]

N in: “host” in address =>True

N: del address[“host”] => {‘port’: 80}

A =set([1,2,3,4]); A numeric set b=set(” hello “), a unique character set. Unlike lists and tuples, the elements in a collection are unordered, cannot be numerically indexed, and cannot be duplicated.

N and set: a | b = > set ([1, 2, 3, 4, ‘h’, ‘l’, ‘o’, ‘e’])

N intersection: a&b => set([])

N difference set: a-b => set([1, 2, 3, 4]), i.e. elements in a but not in B

N symmetric difference set: a ^ b = > set ([1, 2, 3, ‘e’, ‘h’, ‘l’, ‘o’, 4])

N add: a.dd (5) => set([1, 2, 3, 4, 5]

N update: a.u pdate ([June]) = > set ([1, 2, 3, 4, 5, 6, 7, 8]) # add multiple

N the remove: a.r emove (5) = > set ([1, 2, 3, 4, 6, 7, 8]) delete a #

Powerful standard library Clip_image011 [4]

Python has a powerful standard library. The core of the Python language contains only common types and functions such as numbers, strings, lists, dictionaries, and files. The Python standard library provides additional functions such as system administration, network communication, text processing, database interfaces, graphical systems, and XML processing. The Python standard library naming interface is clear, well documented, and easy to learn and use.

The main functions of the Python standard library are:

Text processing, including text formatting, regular expression matching, text difference calculation and merging, Unicode support, binary data processing and other functions file processing, including file operation, temporary file creation, file compression and archiving, operation configuration file and other functions operating system functions, Network communication, including network socket, SSL encryption communication, asynchronous network communication and other functions, support HTTP, FTP, SMTP, POP, IMAP, NNTP, XMLRPC and other network protocols, and provides a framework for writing web servers W3C format support, including HTML, SGML, XML processing. Other features include internationalization support, mathematical operations, hashes, Tkinter, and other third-party libraries. If the strong standard library lays the foundation for Python’s development, the rich third-party libraries guarantee the continuous development of Python. With the development of Python, some stable third libraries have been added to the standard library.

“There are currently 30630 packages here.

clip_image013[4]

3.3. In summary, the following figure shows the power of Python.

clip_image014[4]

Figure: Python (XKCD,

  1. Who else is using Python? Looking at Python in my work, it doesn’t seem to prove anything. Let’s take a look at some of the big companies or well-known applications that use Python and what technologies they use.

4.1. Clip_image016 abroad

Figure: Who uses Python

The figure above is just a sampling of typical companies. It would be difficult to list all of them because so many foreign countries use Python.

At Google, C++, Java, and Python are the top three most used programming languages, and the Python team is the third most used research and development department at Google.

Many projects within Google, such as Google Engine, write high-performance parts in C++ and then invoke the corresponding modules in Python or Java/Go.

Groups.google.com, code.google.com runs on Python. In addition, Python is widely used in basic maintenance departments. Guido Van Rossum joined Google’s first project, Google Mondrian, an online code preview system based on Perforce, BigTable (back-end), and Python (front-end). It uses the following Python-related techniques

The application is built on top of Python open source libraries such as the Django framework, smtpd.py mail service, And the WSGIref Web Server software.

Python was the first programming language to be supported by Google’s ambitious cloud computing platform, Google App Engine.

YouTube is mainly written in Python l Apache

l Python

l Linux(SuSe)

l MySQL

L Psyco, a dynamic Python-to-C compiler

L Lighttpd instead of Apache to do video viewing

most of the lines of code for YouTube are still in Python. Everytime you watch a YouTube video you are executing a bunch of Python code.

YouTube’s problem-solving philosophy has a single word: simple. Many YouTube products started out as simple Python scripts.

Years Of YouTube Scalability Lessons In 30 Minutes

Quora-python Drivers The following is excerpted with its own comments: Quora-Python drivers.

What language and framework does Quora use?

What languages and frameworks were used to code Quora?

From Founder Charlie:

The backend uses Python, Pylons, But the framework was replaced by its own system (LiveNode/ WebNode2) with front-end JavaScript based on jQuery and Thrift for back-end communication between servers (originally developed by Facebook, open source in April 2007, Thrift is a software framework for the development of extensible and cross-language services. Comet Server uses Tornado hosting mainly using Amazon EC2 and S3. Currently, MySQL and memcached are used as cache for database. There are also two services written in C++ as a data store and versioning with Git why did Quora choose Python as the development language

Why did Quora choose Python for its development? The following is a simple arrangement, not a translation.

Adam, the founder, mentioned in his reply that both founders happen to be familiar with Python. In addition, he explained the process of excluding other languages:

PHP doesn’t even consider it. Just because Facebook is stuck doesn’t mean it’s the best choice for now, and the lesson is that programming language choices are important and costly to change. Adam has provided several other links here that point out a number of weaknesses in PHP, including the question “Do Facebook engineers Enjoy programming in PHP?” I seem to agree with the Facebook engineer, “Personality breeds.” There is no perfect language, and every language has its ups and downs. When pushed to the limit, the weaknesses become obvious and annoying. I personally think PHP is still a good choice. C# – looks good but – they don’t want to build the foundation on Microsoft’s technology platform. SQL Server is great, but Quora requires a bunch of open source software, which is poorly supported even if it supports.NET. I don’t want to take any chances with Mono because I don’t know how long it will last and I’ve been told there are performance issues. Java programs can easily get longer for some reason and are a lot more painful to write than Python. Scala is too new and risky, and while not as bad as Java, it inherits some of the WEAKNESSES of the JVM. Python has performance issues, but some of Quora’s performance-critical code is written in C++ (Python’s advantage, Java’s more difficult). As for the lack of type checking, Quora makes up for it with good unit testing.

Quora co-founder Charlie added a few points:

When Quora was created, Python had a lot of nice Web frameworks and Python’s data structures mapped well to JavaScript, It makes it easier to interact data between CS and make Python code easier to read Python has a lot of mature libraries in all aspects of Python why did Quora use Pylons for development

Why did Quora choose to develop in Pylons? Charlie said that they wanted to replace a lot of Pylons with their own. For example, they didn’t need templates and ORM. Pylons is better at this than, say, Django.

One of Facebook’s nine projects transforming the tech industry — Tornado, an open-source web services framework

Tornado, an open-source web services framework developed in the Pyhton language, is one of Facebook’s nine projects that has transformed the tech industry. Tornado is a real-time web server that supports tens of thousands of continuous connections and long-polling.

Tornado was originally developed by FriendFeed, which was acquired by Facebook in 2009. Facebook then launched the Tornado open source project, and Tornado is now being used by several websites, including Quora.

Reddit (the largest online community in the United States) was first developed in Common Lisp and then rewritten in Python (completed in late 2005). The famous Python framework web.py was developed by Aaron Swartz, a Reddit employee at the time, and It has now used Pylons. In November 2009, Reddit migrated to Amazon’s cloud computing platform. The front-end framework is now using jQuery.

Dropbox 99.9% of Dropbox’s code is written in Python. Python uses server-side, desktop clients, web control logic, back-end apis, and analytics.

Dropbox runs on Windows, Mac, and Linux using PyObjs, WxPython, Types, Py2exe, Py2AP, PyWin32 and other tools written in Python.

6 Lessons From Dropbox – One Million Files Saved Every 15 Minutes,

Instagram, acquired by Facebook for $1 billion, mainly uses open-source technologies such as Python.

Application server:

L Use the Django framework.

L Use Gunicorn as WSGI server (used mod_WSGI under Apache in the past, but found Gunicorn easier to configure and saves CPU resources).

L Use Fabric to speed up deployment.

Task queue/publish notification

The queue service uses Gearman, and the working instance (both written in Python) consumes the tasks in the queue at a given time and distributes them to different services; For message Push, the most cost-effective solution found was an open Twisted Service, PyAPNS (A Universal Apple Push Notification Service (APNS) Provider), Has handled over a billion notifications for Instagram and is absolutely reliable.

What Powers Instagram: Hundreds of Instances, Dozens of Technologies,

OpenStack is the cloud computing astrologer software developed by NASA and Rackspace under an Apache license, and is a free software and open source project.

OpenStack is an IaaS(Infrastructure as a Service) component that allows anyone to build and provide their own cloud computing services. In addition, OpenStack can be used to build a Private Cloud within a firewall to share resources among departments in an organization or enterprise.

Tornado Web Server, Nebula Computing platform using Twisted software framework, Open Virtualization Format, AMQP, SQLAlchemy and other standard virtual machine software support include: KVM, Xen, VirtualBox, VMware, Hyper-V 4.2. Domestic clip_image018 [4]

tencent Tencent game operations support system development team, in the use of django/celery/rabitmq/mongo developed an internal open platform has been widely used.

Django: Is an open source Web application framework written in Python. MVC software design pattern is adopted, namely model M, view V and controller C. The main goal of Django is to make it easy to develop complex, database-driven web sites. Django emphasizes reuse and “pluggability” of components, agile development, and the DRY rule (Don’t Repeat Yourself).

Celery is an asynchronous task queue/distributed message passing based job queue. It focuses on real-time operations, but also has good scheduling support. Celery is used in production systems to process millions of tasks per day. Celery is written in Python, but the protocol can be implemented in any language. It can also be implemented with other languages via Webhooks. Celery is easy to integrate the Django, Pylons and Flask, use Django – celery, celery – Pylons and Flask – celery additional packages.

Douban was originally developed in Python and only took 3 months. Hongqiangning, “Python in web2.0”,

clip_image020[3]

The first Douban was developed entirely in Python, with a backend index based on Twisted, Quixote for the GUI, cElementTree, and MySQL for the database. So Douban was born with a Python culture. At Douban, the development environment is gradually moving from Subversion to Mercurial, and there is also traC and IRC written in Python. IRC was chosen because IRC has the flexibility to write bots to automate a lot of things. In addition:

L M.douban.com uses: Pylons

L Internal management system: Django

L DPark system: A MapReduce framework written in Python that supports iterative computation

L DAE(Douban App Engine) : Written in Python, similar to GAE and SAE, positioned as an internal PaaS platform.

Sina SAE Sina App Engine Python is a PaaS(platform as a service) platform developed by Sina, and has begun to support Python. Introduction to SAE Python,

In 2007, Sohu Mail Center released the first Python version of “Sohu Flash Mail” based on WebPY (in addition to Webpy, it also used Tornado, an excellent WEB framework). Since then, Python has flourished on The Sohu mail center. Today, Sohu mailbox has become one of the largest Python applications in China. Python has become the most widely used language on Sohu. From operation and maintenance to development, from business systems to basic services, its shadow exists everywhere.

Zhihu was developed mainly using The FriendFeed framework Tornado. Tornado’s asynchronous, non-blocking I/O model is really refreshing, and Tornado’s advantage is in maintaining a large number of Comet long-polling connections. That’s why FriendFeed developed Tornado —– because FriendFeed requires Timeline updates in real time, and Comet is the best and most popular method by far. Since Zhihu also has a large number of long-polling connections to maintain, Tornado was a reasonable choice.

Tornado is not a silver bullet, however. Since Tornado’s WEB server is single-threaded, if a Request blocks I/O, the process will remain suspended, unable to accept new requests or Finish other blocked requests. It is possible to Spawn multiple Tornado processes, but too many of them will consume a lot of memory. It feels a lot like PHP’s FastCGI process. So requests that block I/O are usually delivered to other dynamic backends using Tornado’s built-in asynchronous HTTP Client. To help you on your way to learning Python, you can take a course from a Python expert. He has free live classes on the Internet at 8 PM every night. He will talk about Python in a very easy to understand and funny way. The greatest value of learning Python from a master is to listen to your words for ten years. The value of self-study is that it is better to study by yourself for half a year than to have a master teach you a day, 365 days a year. He will teach you every night, and there are students who like to listen to it. To his WeiXin * (in Chinese) : in the front row is: 762, in the middle of a row is: 459, the back of a set of is: 510, the above three group of letters can be combined in accordance with the order, very simple, Newton once said, standing on the shoulders of others, you will see higher and further, all rivers run into sea, to conquer the python world of the ocean.

Therefore, Tornado in production generally needs a layer of NGINx as the reverse proxy, and Nginx is used for I/O operations with large data volumes such as static files. Tornado’s I/O time is too precious to spend on it.

Various game companies domestic some game background using Python development, especially some web games. Search for companies that are hiring for Python game development and you’ll find a lot of companies hiring.

Here are some of the articles from PyCon:

L Wang Jian, Python Applications for Medium-sized Role-playing Game Servers,

L Lai Yong Hao, “Application of Python to WebGame”,

Lin Wei (Skywind), Explorations and Discoveries in Python Game Development, shows that Python is simple enough for planners to write code to describe a game scenario in Python. Domestic WebGame has surpassed that of foreign countries, and a large number of game projects on netease are developed with Python related content.

  1. Want to learn Python? With this introduction, you can’t wait to learn Python. The following are recommended Python tools and articles.

Introduction to wiki:

L Python forum materials for Chinaunix

L the OReilly – Learning – Python – 4 th Edition – Oct – 2009″

A Byte of Python

L Deep Python 3,

Tools L UliPad code editing tool (itself written in Python)

L Pydev: Eclipse + Pydev plug-in

L Eric: Free software based on PyQt, powerful.