# -*- coding: utf-8 -*- def normalize(name): name=name[0].upper()+name[:-1].lower() return name # test: L1 = ['adam', 'LISA', 'barT'] L2 = list(map(normalize, L1)) print(L2)
Use the map() function to change the non-standard English name input by the user into uppercase first letter and other lowercase canonical names. Input: ['adam', 'LISA', 'barT'], Output: ['Adam', 'Lisa', 'Bart']
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=324817512&siteId=291194637
Recommended
Ranking