Before we formally start web development, we need to write a web framework.aiohttpis already a web framework, why do we need to encapsulate one yourself?The reason is that, from the consumer's point of view, it aiohttp takes a few steps to write a
A, percent of the way
%[(name)][flags][width]. [Precision]typecode
(name) optional, used to select the specified key
Flags are optional, and the values to choose from are:
+ Right-aligned, positive plus, negative
Operator.itemgetter functionThe Itemgetter function provided by the operator module is used to get the data of which dimensions of the object, with some ordinal numbers (that is, the number of the data that needs to be fetched in the object), as
operator continuation1 arithmetic operations2 comparison operations3 Assignment operations4-bit operation:Note:5 Logical operationsand annotations:1 in Python, and and of the Boolean logic calculus, as you expect, but they do not return a Boolean
The Libnum library is a library of functions for various mathematical operations, including common maths, modular, modular squre roots, primes, factorization, ECC, converting, Stuff and other aspects of the function, the personal feel that combined
QueueThe queue is similar to a pipe, the element is first out, in put(arg) ,get()One thing to note is that the queue is in-memory operation, the process exits, the queue is emptied , and the queue is a blocking pattern.Queue classificationQueues
Class A (object): def test_func (self): print (' From A ') class B (A): Pass # def test_func (self): # print ("From B") class C (A): Pass # def test_func (self): # print ("from C") #多继承, 2.7 and 3.0 is a bit
11, there are a pair of rabbits, from the 3rd month after birth every month, a pair of rabbits, the rabbit long to the third month after the birth of a pair of rabbits, if the rabbit is not dead, ask each month the total number of rabbits?12,
Use the DateTime module to get the current date and time1 Import datetime 2 i=datetime.datetime.now ()3print (" current date and time is%s"% IUse the DateTime module to get the current year1 Import datetime 2 i=datetime.datetime.now ()3print ("
First, try...exceptSometimes when we write a program, there are some errors or exceptions that cause the program to terminate. For example, when division is done, the divisor is 0, which causes a zerodivisionerrorExample:
1234
a=
The list method makes it easy for a list to be used as a stack, a stack as a specific data structure, and the last element to be released (LIFO) in the first entry. append()you can add an element to the top of the stack by using a method. pop()an
1. Use map and reduce write a str2float function to convert a string ‘123.456‘ into a floating-point number 123.456 : fromFunctoolsImportReducedefStr2Num (s):return{'0': 0,'1': 1,'2': 2,'3': 3,'4': 4,'5': 5,'6': 6,'7': 7,'8': 8,'9'8
#Coding=utf-8ImportOS#Import re#set the encoding to utf-8 otherwise you will get an error. At this time sublime console will be reported garbled. But don't worry, utf-8 file doesn't get an error.Importsysreload (SYS) sys.setdefaultencoding ("Utf-8" )
1 Beginner python: Everyone loves the list2 Share your code: function module3 Files and exceptions: Handling Errors4 Persistent Storage: Data saved to file5 Derivation data: processing data!6 Customizing Data Objects: Packaging code and data7 Web
Run the first program hello_world.py# _*_coding:utf-8_*_ Print ("Hello world! ")Output Result:Hello world!Variable# _*_coding:utf-8_*_ "beyoungt"# _*_coding:utf-8_*_ "beyoungt"print= "Abby"Print (name)Output Result:BeyoungtabbyYou can modify the
One, variable1. Variable definition rules1.1. Variable names can only be any combination of letters, numbers, or underscores1.2 The first character of a variable name cannot be a number1.3 The following keywords cannot be declared as variable names [
CommentsSingle line: #Multiple lines: 3 consecutive single or double quotes on top and bottom3 Quotes In addition to multiple lines of comment, you can also print more than one lineExample:msg = "name =" Alex Li "name2 = Nameprint (" My name is ",
Premise:
The modules that Python uses to manipulate Excel are Xlrd, XLWT, Xlutils. Read, write, and update an Excel operation. You need to import these modules first when you operate Excel, as follows:
excel-read operation knowledge points:
This article mainly introduced the Python programming list operation, combined with the instance form analysis Python list creation, the use, the update, the deletion and so on implementation method and the related operation skill, needs the friend
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