1 # !/usr/python
2
3 def nameConvert(name):<span style="white-space:pre"> </span>#格式化名字
4 return name[0:1].upper() + name[1:].lower()
5 print map(nameConvert ,['adam','LISA','brT'])
6
7
8 def prod(x , y ):<span style="white-space:pre"> </span>#reduce算乘机
9 return x * y
10
11 numList = [1 ,2 ,3 ,4, 5, 6]
12 print reduce (prod , numList)
【Python学习笔记】 Python练习题mapreduce
最新推荐文章于 2023-04-21 13:02:05 发布