Python 内置函数

 一 ,内置函数   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()

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()

 

作⽤用域相关:

     locals() 返回当前作⽤用域中的名字

    globals() 返回全局作⽤用域中的名字

迭代器相关:

    range() ⽣生成数据

    next() 迭代器向下执行⼀次, 内部实际使⽤了 next ()⽅方法返回迭代器的下一个项⽬

    iter() 获取迭代器, 内部实际使⽤的是 iter ()方法来获取迭代器

字符串类型代码的执行:

print(eval("2+2"))	# 4
n = 8
print(eval("2+n"))	# 10

def func():
print(666) eval("func()")	# 666

  zip()    函数⽤用于将可迭代的对象作为参数, 将对象中对应的元素打包成⼀个个元组,

     然后返回由这些元组成的开了表. 如果各个迭代器的元素个数不⼀致, 则返回列表长度与最短的对象相同.

http://www.runoob.com/python/python-built-in-functions.html 这里有详细的 

  内置函数的思维导图

posted @ 2018-12-12 21:52  冰哥泡  阅读(140)  评论(0编辑  收藏  举报