Python编程学习笔记

map(int,raw_input().split())

输入以空格为分界符的int变量。

 

filter(function,sequence)

输出满足function函数的sequence序列的元素。

例:a = [1, 2, 3, 4, 5]

       filter(lambda x: x > 2, a),结果为:[3, 4, 5]

 

str.join(str1)

表示在字符串str1中每两个字符之间插入str。

例:”#”.join(“abc”),结果为:a#b#c

 

str.translate(None,str1)

表示输出删除str1中字符的字符串str。

例:”abcdefg”.translate(None, “aeiou”),结果为:bcdfg


你可能感兴趣的:(Python,持续更新...,Python)