Python练习 将list中的字符串依次转为首字母大写(不使用title)

我想先构造一个cap_upper函数,切出字符串首字母转为大写,然后和其余字符接起来;再用map函数对list中的元素依次使用cap_upper。但运行结果为什么是这样。。希望它输出的是['Dog', 'Cat'],求指点。。
补充:想要的是针对题中思路的指正,不用另外找方法,谢谢。。

def cap_upper(lista):
for i in xrange(len(lista)):
lista[i]=lista[i][0].upper()+lista[i][1:]
return lista
aaa=['dog','cat']
print cap_upper(aaa)

 不过我记得有个首字母大写函数capitalize(),直接循环调用这函数就行

温馨提示:答案为网友推荐,仅供参考
相似回答