python之函数用法capitalize()

# -*- coding: utf-8 -*-
#python 27
#xiaodeng
#python之函数用法capitalize()


#capitalize()
#说明:将字符串的第一个字母变成大写,其他字母变小写。
'''
capitalize(...)
    S.capitalize() -> string
    
    Return a copy of the string S with only its first character
    capitalized.
'''



#案例
str='xiaodeng'
print str.capitalize()#Xiaodeng

 

posted @ 2015-11-07 23:00  Xiao|Deng  阅读(5067)  评论(0编辑  收藏  举报