python内置函数,,官方文档all()判


技术分享

官方文档

all()判断所有的元素内是否全部为Ture。

any()只有有一个元素为Ture 则返回Ture。

ascii() 实际上就是执行对应对象的class里面的__repr__ 的结果。

验证方法

class winter:  #创建一个类    def __repr__(self):   #在类里面定义一个__repr__的函数        return "what you can see"   #这个函数什么都做,只返回一个文本f=winter()   #建议个class winter的对象a=ascii(f)   #对这个对象执行asciiprint(a)     #打印结果

  

C:\Python\Python35\python.exe D:/winter_py/practice/winshen_python/day3/004_test.py
what you can see

Process finished with exit code 0

查看的结果为函数的返回值。

python内置函数

评论关闭