Now there is a need:
Assuming that the user entered the English name is not standard, not according to the first letter capitalization, subsequent letter lowercase rules, please use the map () function, a list (including a number of nonstandard English names) into a list containing the canonical English name:
Input: [' Adam ', ' LISA ', ' BarT ']
Output: [' Adam ', ' Lisa ', ' Bart ']
The original idea was to separate the characters, the first to uppercase, the rest to lowercase:
def format_name (s): Return "%s"% (S[:1].upper () + str (s[1:].lower ())) print map (format_name, [' Adam ', ' LISA ', ' BarT ')
Later on, there is a function to convert the initial letter to uppercase (capitalize):
def format_name (s): Return s.capitalize () print map (format_name, [' Adam ', ' LISA ', ' BarT ')
Python first letter converted to uppercase function