One write at the beginning
This article lists some of the commonly used python built-in functions. For a complete and detailed list of Python built-in functions, see the built-in functions section of the Python documentation.
Two python common built-in functions
Please note that the detailed application of the built-in functions and considerations must be found in the official Python documentation. A short summary of the following may have subtle flaws.
| Function |
Function |
Example |
Results |
| ABS (x) |
Returns the absolute value of X |
ABS (-5) |
5 |
| Chr (x) |
Returns the character represented by the integer x |
Chr (65) |
A |
| Divmod (x, y) |
Returns a tuple of quotient and remainder consisting of x divided by Y |
Divmod (44,6) |
(7,2) |
| Float (x) |
Convert x to floating point |
Float (' 56 ') |
56.0 |
| Hex (x) |
Convert x to hexadecimal number |
Hex (34) |
0x22 |
| int (x) |
Convert x to Integer |
Int (34.21) |
34 |
| Len (x) |
Returns the number of elements in parameter X |
Len ([1,3,5,7]) |
4 |
| Max (List-type parameter) |
Returns the maximum value in parameter X |
Max (1,3,5,7) |
7 |
| MIN (list type parameter) |
Returns the minimum value in parameter X |
Min (1,3,5,7) |
1 |
| Oct (x) |
Convert X to eight decimal |
Oct (34) |
0o42 |
| Ord (x) |
Returns the Unicode encoding of the character X |
Ord (' Me ') |
25105 |
| Pow (x, y) |
Returns the Y-order of X |
Pow (2,3) |
8 |
| Round (x) |
Returns the value of four six in X (note that the four six into) |
Round (45.8) |
46 |
| Sorted (list) |
Sort by small to large |
Sorted ([3,1,7,5]) |
[1,3,5,7] |
| STR (x) |
Convert X to String |
STR (56) |
56 (String) |
| SUM (list) |
Calculate the sum of elements in a list |
SUM ([1,3,5,7]) |
16 |
| Type (object) |
Returns the data type of an object |
Type (34.0) |
Float |
Three references
1. Learn Python without obstacles
Common built-in functions for the Python language