1. Python Decorator
Details
2. Set up multiple Python projects using different versions of Python and third-party libraries
Using pyenv
Details
3, PEP8
Details
4. Parameter passing
Pass by reference
5. List parsing, dictionary parsing
Details
6. The difference between a list and a tuple
Once the tuple is assigned, the value can not be changed, the change will be error; The list can be changed arbitrarily.
7. Range () and xrange ()
(1) Range () returns the entire list
(2) Xrange () returns an Xrange object that can be iterated
(3) xrange takes up less memory space because xrange only generates the current object when looping
8. With statement
Details
9. Repeat the Import module or method
A module in Python does not load repeatedly
10. GIL
Global mutex under multi-threading ensures that only one thread in each process obtains the lock at the same time, accessing the relevant resources.
11. Special methods
(1) defined in some class
(2) Do not need to call directly
(3) Some functions or operators invoke the appropriate special method
12. Level Object
No usage restrictions.
The function itself is a level object.
13. class Foo and Class Foo (object)
The first one is the classic class, the latter one is the new class
Details
14. Extract every three items in the list
X is a list, and there are only two ways to do it.
defT1 (x): L=len (x) d= L//3R= L% 3 forIinchRange (d): N= 3 *IPrint('%d,%d,%d'% (X[n], X[n + 1], X[n + 2])) forIinchRange (R): N= 3 *DPrint('%d,'% x[n + i])
def T2 (x): = 0 for in x: print(' % i, end=" )= (n + 1)% 3 if not N: Print ()
Python face question