Basic Knowledge
What does def init mean in the Python class, what does it do, what is the requirement?
Application :
Initializes the value of the instance. These values are typically called by other methods
Requirements :
Initialize values only, do not return values (just don't use returns)
Pyhton and specification for the use of single line and multiline annotation symbols
Single-line Comment: #
Multiline comment: "'" '
Python Fundamentals-Scopes and namespaces (scope and Namespace)
How to output a number in Python Chinese
Python Pass Statement
Python Pass is an empty statement to preserve the integrity of the program's structure.
Pass doesn't do anything, it's usually used as a placeholder statement.
How Python invokes the class method
Python statement: What does "_" mean in the for _ in range (5)?
How can python 1 and 2 return 2?
Getting Started with Python algorithms – Stack (stack)
Python operator
Python lambda gold finger function
sqrt ()
Python sqrt () function
Python Square Root
The sqrt () method returns the square root of the number x.
ABS ()
Python functions Daily-ABS ()
Return absolute Value
Max ()
How do you use the Max function in Python to process the list?
Python List Max () method
Len ()
Python gets string length
Split ()
Python Split () method
Python split () slices a string by specifying a delimiter, separating the NUM substring only if the parameter num has the specified value
CMP ()
Python cmp () function
The CMP (x,y) function is used to compare 2 objects if x < y returns 1 if x = = y returns 0 if x > y returns 1.
Insert ()
Python List Insert () method
The insert () function is used to insert the specified object into the specified position of the list.
Upper () &lower ( )
Python string Capitalization conversion
Upper () converts a string to uppercase
Lower () to convert a string to a lowercase letter
reduce ()
The reduce () function of Python
Reduce () Calls function f repeatedly for each element of the list, and returns the final result value.
Enumerate ()
The enumerate function in Python
The enumerate function is used to traverse the elements in a sequence and their subscript
Range ()
Verbose recording Python's range () function usage
Flatten ()
Flatten usage in Python
sum ()
summation function sum in Python
The argument for sum () is a list
isupper ()
The Isupper () method used in Python to check the English letter capitalization
The Isupper () method checks whether all uppercase characters (letters) of a string are capitalized.
Ord () &CHR ( )
How to turn a character into a ascll value in Python
Ord (): Character variable ASCII
Chr (): ASCII variable character module
operator Module
Python operator-standard function operation
Collections Module
[Counter class of Python standard library--collections module]
(http://www.pythoner.com/205.html)
Copy Module
Use copy module to implement list copy in Python
If you want to achieve deep copy, you might use Copy.deepcopy () to sort The data operations
The sort method in Python uses the detailed
Python List sort () add key and reverse parameter action method
Python string Sorting method
Python sort, sorted advanced sorting tips
Dictionary key or key value sorting in Python
>>> student_tuples = [
(' John ', ' A ',
], (' Jane ', ' B ', '),
(' Dave ', ' B ',],
]
>> > Sorted (student_tuples, Key=lambda student:student[2]) # Sort by age
[(' Dave ', ' B ',], (' Jane ', ' B ', 12), ( ' John ', ' A ',]
---------------------------------------------------
//Shoes are bad, and if necessary, add reverse= True to further implement the sort you want
sorted (Dict.items (), Key=lambda e:e[1], reverse=true)
List
Python_python four ways to traverse a list
/* personal prefer to use the following two ways to traverse the list/
list=[1,2,3,4,5]
///Similar Java enhanced for loop:
for I
in list: print I
//naive traversal, You can get to the element index: for
i in range (len (list)):
print List[i]
Python list Operation detailed
Python implements list array transpose
How to traverse an array in reverse in Python
Python two list intersection, and set, difference set String
Handling of Nonetype in Python string processing
Python string strings Lookup Find and Index method
Python string inversion
s = ' ABCDE '
S[::-1]
How Python determines whether a string contains substrings
Directly with in and not, and to and not is the same
Python advanced-python implements substring intercept substring
Python generates a string with a length of 100, and the value is all 1
(' 1 ' *100)
How Python Compares two strings
Compare directly with "= ="
Python data type conversions (str to int conversion)
String str converts to Int:int_value = Int (str_value)
int converts to string str:str_value = str (int_value) Dict
Python Dictionary items return list, Iteritems return iterator
The dictionary items () method and the Iteritems () method are built-in functions of the Python dictionary that return the Python list and iterator Set
How set in Python only takes the result Queue
Python queue \ Debug
Python code problem typeerror: ' int ' object is not callable
For example, when you use the Max function in your program, but you define a variable with the same name as the function, you may get a similar error P.K. how to differentiate between functions and methods in Python.
function (functions) and Methon (method) in Python
string concatenation in Python
The use and distinction of Python collections.defaultdict () and Dict