内置函数就是Python给你提供的,拿来直接用的函数,比如print.,input等。
截止到python版本3.6.2 ,python一共提供了68个内置函数,具体如下??
abs() dict() help() min() setattr() all() dir() hex() next() slice() any() divmod() id() object() sorted() ascii() enumerate() input() oct() staticmethod() bin() eval() int() open() str() bool() exec() isinstance() ord() sum() bytearray() ?lter() issubclass() pow() super() bytes() ?oat() iter() print() tuple() callable() format() len() property() type() chr() frozenset() list() range() vars() classmethod() getattr() locals() repr() zip() compile() globals() map() reversed() __import__() complex() hasattr() max() round() delattr() hash() memoryview() set()
print(bin(10)) # 二进制:0b1010 print(hex(10)) # 十六进制:0xa print(oct(10)) # 八进制:0o12
print(abs(-2)) # 绝对值:2 print(divmod(20,3)) # 求商和余数:(6,2) print(round(4.50)) # 五舍六入:4 print(round(4.51)) #5 print(pow(10,2,3)) # 如果给了第三个参数. 表示最后取余:1 print(sum([1,2,3,4,5,6,7,8,9,10])) # 求和:55 print(min(5,3,9,12,7,2)) #求最小值:2 print(max(7,3,15,9,4,13)) #求最大值:15
https://mp.weixin.qq.com/s/F9WxFn40RQnpCChxhslcOw
原文:https://www.cnblogs.com/luweiweicode/p/15203252.html