@classmethod annotation method, will pass the class itself as a parameter, the advantage is that I can not invade the original code for function operationThe context management function, __enter__ and __exit__ functions, can be used to define the methods that are executed when using the method that executes when entering the function and the Exit function, where the WITH keyword is used to invoke the function.The classic scenario is to make the file read, using the WITH function to ensure that
elements and inserts elements quickly6. Sequence Unpacking:' Vttalk ' ' female ' ' [email protected] ' = P7 . Traverse the dictionary key and value for inch D.iteritems (): Note: Iteritems returns an Iterator object, only the items method in Python3, equivalent to Iteritems Print ' ---> ', V8. Chain comparison operation: If Guess:>>> false = = False = = True (The answer is: false)9,if/else three mesh operation:' male ' if ' male ' Else ' female '10, truth value judgment:if If attr = = True:if
How do we refresh the output in the same row?The answer is carriage return .Note that the carriage return is not the same thing as a newline.Enter: Moves the current cursor to the beginning of the line. (\ r, return, CR, carriage return)Line break: The cursor position is unchanged, changing to the next line. (\ n, newline, LF, line Feed)The previous memory is very expensive, some people think the end of each line plus 2 characters too wasted, add one on the line. This results in a slightly diffe
According to test instructions, we can't use keywords such as if/else/for/while.------------in--------------thinkingIdeas:1. Recursive implementation of loops2. Recursive termination conditions do not use if how to judge it? The answer is a dictionary in which the number n is converted to bool with not not n.On the code:def sum_ (n): return n + { True:lambda:sum_ (n-1), false:lambda:0 }[not not n] () print sum_ (100)Elegant
:
1
ifnin[1,4,5,6]:
To replace the following method:
1
ifn==1 or n==4 or n==5 orn==6:
string/Inverse sequenceYou can use the following methods to quickly reverse the sequence of columns:
12345678
>>> a= [1,2,3,4]>>> a[::-1][4,3,2,1]# This creates a new reversed list.# If you want to reverse a list in place you can do:a.reverse()
This general approach also applies in reverse order of strings:
ifsuch as e-commerce, customers to buy things, through multi-criteria screening, data exist MongoDB, attributes have price/brand/size/color.The user may not set or set multiple filter criteria, and we want to judge each one.According to the general wording, it should be:QUERYEXR = {}if Price: queryexr.update ({' P ':p rice}) If Brand: queryexr.update ({' B ': brand}) if size: Queryexr.update ({' s ': size}) If color: queryexr.update ({' c ': color}) Dp.collection.find (QUERYEXR)Too
Japanese-style fresh and elegant wind, that is, and wind, is a Japanese photographer to use a special tone. Features can be summed up as: dilute the peace, natural freehand brushwork. The highest rate of domestic awareness for Kanoeron, small Lin Jiqing, and its clear, almost sad style, attracted a large number of fans at home. Of course, there are many disgusted with the irony of the "cataract defects Photo Method" ... Tastes, please.
Unfortunately,
The soft, dreamy color of the wedding film has never lacked the appreciation of the fans and advocates, they are soft and elegant color, easy to create a sweet breath and romantic atmosphere. However, this soft color, in the early stage of the shooting is almost impossible to appear perfectly, it requires the late adjustment of the steps of the fine carving, "polished" the attractive color. This article is specially aimed at the most popular soft tone
The final effect for us very much like the Japanese elegant style. Like friends can come together to study, don't forget to do homework.
First look at the effect and original image:
The following is a detailed tutorial "
The first step: use Photoshop to open the original image, copy a layer for layer 1, in order to increase the sensitivity of the picture contrast, the implementation of graphics-adjustment-color, and then sli
Click to see more "ps wedding photo processing tutorial
The tutorial teaches you to use Photoshop to get the elegant Korean style wedding photo effect, the color palette is to change the specific hue to form another tonal picture of different feelings.
The correct way to learn color, first of all, is to carefully interpret the color composition of Photoshop theory, first of all, the theory of color composition chipboard, and then take some typical d
This tutorial mainly uses Photoshop to pull out the photos of the outdoor children's photo day elegant effect, Japanese and Korean photo style is full of color candy, such as orange, green, blue, pink and other high gray, high-profile colors, this color gives people the feeling is: warm, comfortable and sunny, like friends let us learn together.
Effect Chart:
Original:
The first step: Copy the layer first I suggest in the la
The soft, dreamy color of the wedding film has never lacked the appreciation of the fans and advocates, they are soft and elegant color, easy to create a sweet breath and romantic atmosphere. However, this soft color, in the early stage of the shooting is almost impossible to appear perfectly, it requires the late adjustment of the steps of the fine carving, "polished" the attractive color. This article is specially aimed at the most popular soft tone
going to be slow to inherit so many layers? Sure, the deep prototype chain will be slow, but I have a way. Remember what happens when you write to an object's properties?
Copy Code code as follows:
var ego = function (x) {return x}
For (var all in driver) {
if (! (each in nulldriver)) {
Driver[each] = ego (Driver[each])
}
}
Yes, the original high in the prototype chain above the method will "wow" a bit fell to the bottom! This time not to go up the prototype ch
lightweight and very user-friendly, its API is also very easy to understand, but also provides some very convenient instructions and attributes.
For example:
(1) Bind Click eventcan be abbreviated as:
(2) Binding dynamic properties
can be abbreviated as:
(3) Handy modifiers
(4) Practical parameter characteristics
How about, is not feeling very elegant.
Compact
Speaking of small, it should be the first to pay attention to the source siz
many layers
Is it going to be slow? Sure, the deep prototype chain will be slow, but I have a way. Remember what happens when you write to an object's properties?
Copy Code code as follows:
var ego = function (x) {return x}
For (var all in driver) {
if (! (each in nulldriver)) {
Driver[each] = ego (Driver[each])
}
}
Yes, the original high in the prototype chain above the method will "wow" a bit fell to the bottom! This time not to go up the prototype chain, di
The previous (ASP.net extended ExtJS) article used the old method to add a subclass, creating a list
Using the. NET self-action
ASPX code:
.Columns .Columns .ToRender() %>
C # code
public ExtWindow Columns { T t=new T() ; columnBuilder(t); Item.Add(t); return this; }
The generated JS code is still not listed as above.
You can see that the method of using columns is still not elegant enough, since all controls are based
If we have more than one Linux server, and need to manage maintenance, if you are using putty, usually you will open multiple Windows without a window is a server account login. This can make you confused if we can manage through the following so is it much easier?What tools and skills do we need to complete the above operations:
Generate Keys for individual servers
SSH Password-free interoperability for each server http://www.voidcn.com/article/p-ficywqgl-oz.html
The
This blog is reproduced in: http://devbean.javaeye.com/blog/412296
Elegant encapsulation or execution efficiency? This is a paradox.
The elegant encapsulated program looks so beautiful: after each property is hidden in an object, what you can see is that this object makes
As you can see, you don't need to worry about how it operates.
The execution efficiency is another thing. It is like the difference betw
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.