capitalize的用法
capitalize() is an in-built method in Python, it returns the string in Capitalized case, in which first character of the sentence is in uppercase and rest of the characters are in lowercase.
capitalize()是Python中的内置方法,它以大写形式返回字符串,其中句子的第一个字符为大写,其余字符为小写。
Syntax:
句法:
String.capitalize()
Parameter:None
参数:无
Return type:It returns capitalize case string.
返回类型:返回大小写字符串。
Example:
例:
# str1str1 = "Hello world, how are you?"print str1.capitalize ()# str2str2 = "HELLO WORLD, HOW ARE YOU?"print str2.capitalize ()# str3str3 =