python小程序,规范用户输入英文名的大小写(首字母大写)

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基础)