这个为什么能表示首字母大写?s[:1]应该表示的是adam这个整体啊,adam的索引就是S[0]啊,求解
def format_name(s):
return s[:1].upper()+s[1:].lower()
print map(format_name, ['adam', 'LISA', 'barT'])
def format_name(s):
return s[:1].upper()+s[1:].lower()
print map(format_name, ['adam', 'LISA', 'barT'])
2017-02-27
举报