def normalize(name):
n = name.upper()
if len(n) > 1:
n = n[0] + n[1:].lower()
return n
L1 = ['fgdfg', 'WER', 'DFcf']
L2 = list(map(normalize, L1))
print(L2)
python小程序,规范用户输入英文名的大小写(首字母大写)
最新推荐文章于 2022-09-05 14:54:49 发布
def normalize(name):
n = name.upper()
if len(n) > 1:
n = n[0] + n[1:].lower()
return n
L1 = ['fgdfg', 'WER', 'DFcf']
L2 = list(map(normalize, L1))
print(L2)