python 英文字串首字母改为大写

#英文字串首字母改为大写
st = "string"
St = st[0].upper() + st[1:]

2016-10-22

后来了解到 python 内部有相关实现,感觉 python 好贴心~~~

>>> "hehe he hehe".capitalize()
'Hehe he hehe'

>>> "hehe he hehe".title()
'Hehe He Hehe'