求助;把用户输入的不规范的英文名字,变为首字母大写,其他小写的规范名字
L1 = ['AdmIn','anny','LUCY','sandY','wILl']def normalize(name):
return name.upper()+name.lower()
normalize(L1)
AttributeError: 'list' object has no attribute 'lower'
请大佬帮忙解答问题出在哪里,谢谢 name=字符 name=列表 L1 = ['AdmIn','anny','LUCY','sandY','wILl']
def normalize(name):
return
print(normalize(L1)) title >>> L1 = ['AdmIn','anny','LUCY','sandY','wILl']
>>> L2 = list(map(str.title, L1))
>>> L2
['Admin', 'Anny', 'Lucy', 'Sandy', 'Will'] bloodbat007 发表于 2021-12-22 10:39
name=字符 name=列表
谢谢!
页:
[1]