We had a preview of the Python DB API exception yesterday, so let's take a look at it today:1, all the abnormal super class: StandardError;2, Waring: belong to the StandardError super class, the occurrence of non-fatal problems so abnormal;3, Error:
Programmer century PuzzleThe first thing people say about programmers is: I know! They have a high salary! But most of them are single dogs, they don't know how to be funny, they just wear plaid polo shirts every day. Even programmers describe
Use of adorners:Use when you do not want to modify the function's invocation, but want to add content to the functionWhy use adorners: Software entities should be extensible and non-modifiable. In other words, the extension is open, and the
Loop statement: Repeat, to do the same or type of thing under a certain condition,Three elements of a looping statement:Cyclic condition + cyclic body + cyclic condition changeWhile condition: Loop body Cyclic condition Change...While
One, iteratorWe already know that for there are several types of data that can be directly acting on a loop:A class is a collection of data types, such as,,, list tuple , and dict set str so on;One is generator to include the generator and yield the
StringA string is ‘ any text enclosed in single or double quotation marks " , such as ‘abc‘ , and "123" so on.Note that ‘‘ or "" itself is just a representation, not part of a string, so the string is ‘abc‘ only a , b c this 3 characters. If it ‘ is
1. How the For loop works:For loop:D={' A ': 1, ' B ': 2, ' C ': 3}for i in D: print (i)Principle: The For loop is actually the d.__iter__ of the D in the back ()# Todo Loop first time: obj=d.__iter__ () i=obj.__next__ () print (i) # Todo loop
The basic idea of fast sorting: to find an element in an unordered list, with this element as the benchmark, all other elements are compared to the element, smaller than the element becomes a sub-sequence, larger than the element becomes another sub-
Recently learned Python iterators and generators, the generator is a feature, is to use the data will be used to fetch! Look at the following code and think about it, and you'll understand what lazy computing is!1 defAdd (S, x):2 returnS +x3 4 5
ITER (Iterable)An iterator can be generated.Example:Islice(iterator, int, int)Itertools The islice method provides a slicing operation for the iterator generator. Example:IZip_Longest(Iterable, iterable)Itertools of i Zip _ Longest The method is
(iii) Configuring the PYTHON3 compilation Environment1. Click the upper menu bar tools->build system->new Build System2. After clicking, an empty configuration file appears, and the following code is copied to this empty configuration file:?
Scope: variable, functionpublic (public): can be directly referenced, such as: ABC, PI, test (), similar to __xxx__ such a special variable. Lenovo : In the C language, when something in the module wants to be referenced externally, it is preceded
Scope: variable, functionpublic (public): can be directly referenced, such as: ABC, PI, test (), similar to __xxx__ such a special variable. Lenovo : In the C language, when something in the module wants to be referenced externally, it is preceded
1. String Formatting: Format1 #format2S0 ="my Name {}, this year {} years old, I like { }". Format ("Wang Leehom", 46,"Wahaha")#format by Location3S1 ="My name is {0}, this year {2} years old, I like {1}". Format ("Wang Leehom","Wahaha", 46)#Specify
I. Demand analysis
Enter the salary amount, enter the shopping cart, and print out the product number and price, the user can enter the product number to buy goods
Print prompt when the balance is insufficient
Exit settlement via Q
Format:Sorted (list)/sorted (list, function)Website Explanation:
sorted(iterable[,CMP[,Key[,Reverse]]])
Return a new sorted list from the items in iterable. #返回一个排序过的新的可迭代的列表
Detailed sorted usage by official
Immutable objects (string, tuple) 1.a = 1Object 1 is first created in memory, and the reference count of the object is recorded 1 times.
id(a)View the memory address of the object referenced by variable a
2.b = 1Object 1 already exists
python3.5 useDay Fourth: Last time I learned more in-depth input and output writing, this time we are learning the process to determine if else we use the last practice of the interactive program to learn them (by the way again practice)1 username=
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