def normalise(s): return s.capitalize()
L=['adam', 'LISA', 'barT']
N=list(map(normalise, L)) print(N)
def normalize(x) : return x[:1].upper()+x[1:].lower()
这个结果能帮解释下是为什么不对的吗? return [x[:1].upper()+x[1:].lower() for x in name]
Sign in to make a reply
lianwade3
!/usr/bin/env python3
-- coding: utf-8 --
def normalise(s): return s.capitalize()
L=['adam', 'LISA', 'barT']
N=list(map(normalise, L)) print(N)