Common built-in functions in python

Common built-in functions

1. Mathematics-related built-in functions:

abs: find the absolute value
divmod: find the quotient and remainder of two elements
max: find the maximum value
min: find the minimum value
pow: find the exponentiation
sum: use for summing
round: round up to the specified position

2. Iterable related built-in functions

all: Convert all elements to boolean values, all true, the value is true
any: as long as one element is converted to boolean value is true, the result is true
sorted: used for sorting

3. Conversion related:

bin: Convert the number to binary
Oct: Convert the number to octal
hex: Convert the number to hexadecimal
chr: Convert the character encoding to the corresponding character
ord: Convert the character to the corresponding
encoding eval: Execute the correlation in the Python string The program
repr: used to convert data into string form

4. Variable correlation:

globals: view all global variables
locals: view all local variables

5.

dir: point out all the methods and properties of the object exit: end the program ID
with the specified exit code : get the memory address of a data help: view the help documentation)

6. Input and output related:

print: print data
input: let the user enter content

7. Judgment related to the object:

isinstance: to determine whether an object is created by a class
isubclass: to determine whether a class is a subclass of another class

8.open: used to open the file

Guess you like

Origin blog.csdn.net/gubeiqing/article/details/112986850