首页 > 编程语言 > 详细

python3-day3(内置函数)

时间:2016-02-14 19:38:59      阅读:183      评论:0      收藏:0      [点我收藏+]
1.内置函数
  1>print(bytearray(‘王‘,encoding=‘utf8‘))
  2>print(bytes(‘王‘,encoding=‘utf8‘))
  3>bool(‘‘)
  4>all(["",None,{},[]])

  5>f= lambda a: a+1
  6>callable(f) #可调用,
  7>chr(97)
  8>ord(‘a‘)
  9>#compile()
  10>#enumerate
    li=[‘alex‘,‘tom‘,‘lily‘]
    for i,item in enumerate(li,1):
    print(i,item)

  11>#eval
    memory="6*8"
    print(eval(memory))
  12>#map
    li=[11,22,33,44]
    def func(x):
      return x + 100
    new_li=map(func,li)
    print(list(new_li))
  13>#filter
    li=[11,22,33,44]
    def f(x):
      if x > 33:
        return True
      else:
        return False
    n=filter(f,li)
    print(list(n))
2.官方
https://docs.python.org/3/library/functions.html#next

 

 Built-in Functions  
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() filter() issubclass() pow() super()
bytes() float() 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()  


python3-day3(内置函数)

原文:http://www.cnblogs.com/weibiao/p/5189432.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!