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 这里有详细的 

  内置函数的思维导图

转载于:https://www.cnblogs.com/zhaoyubing/p/10111252.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值