第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > capitalize的用法_Python字符串| 使用示例的capitalize()方法

capitalize的用法_Python字符串| 使用示例的capitalize()方法

时间:2021-11-02 22:25:51

相关推荐

capitalize的用法_Python字符串| 使用示例的capitalize()方法

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 =

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。