filter    参数中函数返回True或者False,将元素返回到结果

li = [1,2,3,4,5,6]

f = lambda a: a>3    原理:简单函数用lambda;a相当于参数,"a>3"是函数体,有返回值

filter(函数A,可迭代序列B)   原理:把B的值逐个给A,过滤机制在函数A中,返回True时输出当前B的值,否则不输出   

filter(lambda a: a>3,li)


def  f1(a):

    if  a>3:

        return True

print(list(filter(f1,li)))


结果:[4,5,6]


map    参数中函数返回指定值,将结果返回


def  f1(a):

    return a+3

map(f1,li)

print(list(map(f1,li)))

结果:[4, 5, 6, 7, 8, 9]


结合lambda是   map(lambda a: a+3,li)


len()   

python2中只能按照字节计算

python3可以按照字符也可按照字节,默认是字符,需要把字符转换成字节,才能按照字节计算


ord  chr  转换ascii值

round 四舍五入


必会内置函数

zip   abs all any bin bool bytes chr compile delattr dict dir divmod enumerate eval exec  filter float helo hex input id int isinstatnce len list locals map max min oct open ord pow print range round set sorted str sum tuple type