分享

68个python内置函数总结

 Yy3318q 2021-12-16

图片

 

手机版本

关联阅读:Python3内置函数总结

python 68个内置函数

迭代器/生成器相关(3)

range

next

iter

作用域(2)

locals

globals

反射相关(4)

hasattr

getattr

setattr

delattr

和数据结构相关(24)

序列(13)

  • 列表和元组(2)

    • list

    • tuple

  • 相关内置函数(2)

    • 参数:序列

    • 返回值:反序迭代器

    • reversed

    • slice

  • 字符串(9)

    数据集合(3)

    • 用于%r格式化输出

    • 字符串转ascii

    • 数字按照unicode转字符

    • 字符按照unicode转数字

    • memoryvies(bytes('hello,eva',encoding='utf-8'))

    • bytearray(s,encoding='utf-8')

    • bytes(s,enconding='utf-8')

    • http://www.cnblogs.com/linhaifeng/articles/7133357.html

    • str

    • format

    • bytes

    • bytearray

    • memoryview

    • ord

    • chr

    • ascii

    • repr

  • 字典(1)

    • dict

  • 集合(2)

    相关内置函数(8)

    • set

    • frozenset

  • len

  • enumerate

  • all

    • 判断是否有bool值为False的值

  • any

    • 判断是否有bool值为True的值

  • zip

    • 返回一个迭代器

  • filter

    • http://www.cnblogs.com/linhaifeng/articles/7133357.html

  • map

    • http://www.cnblogs.com/linhaifeng/articles/7133357.html

  • sorted

    • http://www.cnblogs.com/linhaifeng/articles/7133357.html

和数字相关(14)

数据类型(4)

  • bool

  • int

  • float

  • complex

    进制转换(3)

  • bin

  • oct

  • hex

    数学运算(7)

  • abs

    • 计算绝对值

  • divmod

    • 返回(除,余)

  • round

    • round(2.1213345245,2)

    • 小数精确

  • pow

    • pow(x,y,z)

    • x**y

    • x**y%z

    • 幂运算

  • sum

    • sum(iterable,start)

    • iterable参数必须是一个可迭代数字集

    • start指出求和的初始值。start和iterable中的值为最终的和

    • 求和

  • min

    • min(iterable,key,default)

    • min(*args,key,defult)

    • min({1,2,3,4,-5})

    • min({},1)

    • min({1,2,3,4,5},key=lambda n:abs(n))

    • 计算最小值

  • max

    • max(iterable,key,default)

    • max(*args,key,default)

    • 计算最大值

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多