List of Python built-in functions

Function (click to jump to the example) use
abs() Returns the absolute value of a number
all() Judge whether all elements in the given iterable parameter iterable are TRUE, return True if it is, otherwise return False
any() Judge whether the given iterable parameters are all False, then return False, if one of them is True, then return True
ascii() Call the repr() method of the object to get the return value of the method
bin() Convert decimal to binary
oct() Convert decimal to octal
hex() Convert decimal to hexadecimal
bool() Is the test object True or False
bytes() Convert a character to byte type
str() Convert character and numeric types to string types
callable() Check if an object is callable
chr() View ASCll characters corresponding to decimal integers
words() View the decimal corresponding to an ascii
classmethod() The function corresponding to the modifier does not need to be instantiated, and does not need the self parameter, but the first parameter needs to be the cls parameter representing its own class, which can call the properties of the class, the method of the class, and the instantiated object, etc.
compile() Compile the string into code that python can recognize or can execute. You can also read the text as a string and then compile it
complex () Create a plural
delattr() Delete object properties
dict() Create a data dictionary
to you() When the function has no parameters, it returns the list of variables, methods and defined types in the current scope
divmod () Take the quotient and remainder respectively
enumerate() Return an enumerable object, the next() method of the object will return a tuple
eval() Evaluate the string str as a valid expression and return the calculation result to retrieve the contents of the string
exec() The string compiled by the implementation of the string or the complie method has no return value
filter() Filter, construct a sequence, equivalent to
float() Convert a string or integer to a floating point number
format() Formatted output string
frozenset() Create an unmodifiable collection
getattr() Get object properties
globals() Return a dictionary describing the current global variables
hasattr () Function is used to determine whether the object contains the corresponding attribute
hash() 返回对象的哈希值
help() 返回对象的帮助文档
id() 返回对象的内存地址
input() 获取用户输入内容
int() 用于将一个字符串或数字转换为整型
isinstance() 来判断一个对象是否是一个已知的类型,类似 type()
issubclass() 用于判断参数 class 是否是类型参数 classinfo 的子类
iter() 返回一个可迭代对象,sentinel可省略
len() 返回对象的长度
list() 返回可变序列类型
map() 返回一个将function应用于iterable中每一项并输出其结果的迭代器
max() 返回最大值
min() 返回最小值
memoryview() 返回给定参数的内存查看对象(memory view)
next() 返回可迭代对象的下一个元素
object() 返回一个没有特征的新对象
open() 返回文件对象
pow() base为底的exp次幂,如果mod给出,取余
print() 打印对象
class property() 返回property属性
range() 生成一个不可变序列
reversed() 返回一个反向的iterator
round() 四舍五入
class set() 返回一个set对象,可实现去重
class slice() 返回一个表示有1range所指定的索引集的slice对象
sorted() 对所有可迭代的对象进行排序操作
@staticmethod 将方法转换为静态方法
sum() 求和
super() 返回一个代理对象
tuple() 不可变的序列类型
zip() 将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表

Guess you like

Origin blog.csdn.net/KH_FC/article/details/106135096