码迷,mamicode.com
首页 > 编程语言 > 详细

python内置函数

时间:2017-04-21 19:09:20      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:tar   src   bsp   logs   self   技术   返回   highlight   class   

技术分享

 官方文档

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)   #对这个对象执行ascii
print(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内置函数

标签:tar   src   bsp   logs   self   技术   返回   highlight   class   

原文地址:http://www.cnblogs.com/wintershen/p/6744853.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!