Implement the many-to-many check box effect of Django AdminEffects: Unselected fields on the left, selected fields on the right, and tabs on both sides can be exchangedFirst, add the Filter_horizontal field in king_admin.py1 classcustomeradmin
Import Time#use adorner to test the run time of the co-processdeffunc (fun):defWapper (*args,**Kwargs): Start=Time.time () Fun (*args,**Kwargs) End=time.time ()Print(end-start)returnWapper#Producer Consumer Modeldefconsumer (): R="'
One, assignment operators=: An assignment operator, such as x = 2, can also be multi-assigned, such as x = y = z = 2, or multiple assignments, such as x, y, z = 1, 2, 3, assigning 1, 2, and 3 to X, Y, Z, respectively+=: plus etc, such asx + =
What to learn today:One, supplementary style operation1. CSS (NAME|PRO|[,VAL|FN]) accesses the style attribute of the matching element $ ("P"). CSS ("color") gets the value of the color style property of the first paragraph$ ("P"). css ({"Backgroud":
1. Cause of the problemSupervisor High version in the Guardian python2.7 service, will crit and error and fall to the process block (Python process exists, but not running) problem, generally with the character set is related' exceptions.
Function
Definition of a function keyword: def
Using the global statement makes it clear that the variable is defined outside the block
Example: (The value of X is 2 after the function has finished running)
#!/usr/bin/python#
names = [' Jack ', ' Rose ', ' Tom ', ' Jerry ', ' Jerry ']print (names) print (Names[0]) names[0] = ' Adam ' # change print (Names[0]) Print (names[2:]) # from left to right all print (names[-3:]) # Right Start right all print (Names[:-2]) #
Python Learning Lesson Two: Using BeautifulSoup to crawl linked regular expressions
View the BeautifulSoup document (view the corresponding document according to the version of your installation)
Document Link
Binary tree is a very important data structure, and it is a very important role in the interview and daily Development.The first is the process of building a tree, compared to the implementation of C or C + +, it involves a more complex pointer
# Set auto-weight, but no value, only keys = Set ([3, 5, 9, ten]) # Create a collection of valuest = Set ("Hello") # Creates a collection of unique charactersx = ' x 'A = T | the set of S # T and Sb = Intersection of T & S # T and Sc = T -S #
Answer = 10for i in range (3): guess = int (input (' guess One ')) if guess = = Answer: print (' OK ' ) break Elif guess > Answer: print (' Guess big ') else: print (' guess small ') Else: print (' ran out
The break statement can jump out of a for and while loop body.The continue statement is used to tell Python to skip the remaining statements in the current loop block and proceed to the next round of loops.Write a multiplication table with break
Idea: 1. Use a stack to save the node (list implementation); 2. If the node exists, enter the stack, and then point the current pointer to the left dial hand tree until it is empty; 3. If the current node does not exist, the top element of the stack
1. Matche method and search method for reMatch methodMatch (string[, pos[, Endpos])String: Matches the text used,POS: The index in which the text expression begins the search. and start searching for the subscript for stringEndpos: The index of the
Object-oriented programming is one of the most effective methods of software writingCreate a Dog classclassDog ():" "a simple test to simulate a puppy" " def __init__(self,name,age): Self.name=name Self.age= Agedefsit (self):" "simulated puppy is
NumPy stops supporting Python 2 and numpypython
The NumPy project announced that it would stop supporting Python 2. The Python core team has decided to stop supporting Python 2 in 2020, while the NumPy project supports both Python 2 and Python 3
Multiple implementations of Binary Tree creation and traversal (python version), binary tree python
Binary Tree is an important data structure and plays an important role in interviews and daily development.
The first is the process of building a
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