天天看点

python map()练习小实例

利用map()函数,把用户输入的不规范的英文名字,变为首字母大写,其他小写的规范名字。输入:['adam', 'LISA', 'barT'],输出:['Adam', 'Lisa', 'Bart']。

list=['adam', 'LISA', 'barT']
def max(x):
  return x[0].upper+x[1:].lower()

print map(gf,list)