1. type(a): Get the type of the object
2. isinstance(a,(int,float)): Determine the type of the object
3. iter(obj): Determine whether it is an iterable object
4. s=r'a\b\c\d': add r to the leftmost side of the string, indicating that all characters are interpreted according to the original style, saving the trouble of writing transfer characters ('\')
5. '%.2f %s are word $%d' % (4.5555, 'ABCDE', '1') String formatting method: %.2f means a number with 2 decimal places; %d means an integer; % s represents a string; when outputting, replace the previous formal parameters with the actual parameters in the parentheses () after %
6. bool([]): Determine which boolean value an object will be coerced to
7, str, bool, int and floot can do type conversion
8. try:
<statement>
except <name>:
<statement> #If an exception named 'name' (such as TypeError, ValueError) is raised in the try part, execute
else:
<statement> #If no exception occurs, then execute
finally:
<statement> #Execute regardless of whether the try is successful or not
9. The built-in function of list:
a.append("AAA"),
a.insert(3,"AAA"),
a.pop(3),
a.remove("AAA"),
a.extend("AAA","BBB")
a.sort a.sort(key=len)
bisect.bisect(list, 2): Determine the sorting position of element 2 in the list, the list needs to be sorted
bisect.insort(list, 2): Insert element 2 into the list in order
sorted(list): returns a sorted list
10: iterable is an iterable iterator is an iterator An iterable object can be converted into an iterator through the iter() function