def normalize(name):
s=name[0].upper() + name[1:].lower()
return s
测试:
L1 = ['adam', 'LISA', 'barT']
L2 = list(map(normalize, L1))
print(L2)
def normalize(name):
s=name[0].upper() + name[1:].lower()
return s
L1 = ['adam', 'LISA', 'barT']
L2 = list(map(normalize, L1))
print(L2)
本文标题:2018-10-28:map的使用,返回首字母大写,名小写
本文链接:https://www.haomeiwen.com/subject/nuqotqtx.html
网友评论