abstract:例如輸入:['adam', 'LISA', 'barT'],輸出:['Adam', 'Lisa', 'Bart']。方法一def wgw(x): return [x[0].upper(),x[1:].lower()] map(wgw,[
例如
輸入:['adam', 'LISA', 'barT'],輸出:['Adam', 'Lisa', 'Bart']。
方法一
def wgw(x): return [x[0].upper(),x[1:].lower()] map(wgw,['adam','LISA','barT'])
方法二
def wgw1(x): return x.capitalize() map(wgw1,['adam','LISA','barT'])
方法三
map(lambda x:x.capitalize(),['adam','LISA','barT'])
總結(jié)
以上就是Python實(shí)現(xiàn)將不規(guī)范英文名字首字母大寫,其他小寫的規(guī)范名字的全部內(nèi)容,希望本文的內(nèi)容對大家學(xué)習(xí)或者使用python能有所幫助,如果有疑問大家可以留言交流。
更多關(guān)于Python實(shí)現(xiàn)將不規(guī)范的英文名字首字母大寫請關(guān)注PHP中文網(wǎng)(ipnx.cn)其他文章!