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:
例:
# str1
str1 = "Hello world, how are you?"
print str1.capitalize ()
# str2
str2 = "HELLO WORLD, HOW ARE YOU?"
print str2.capitalize ()
# str3
str3 = "hello world, how are you?"
print str3.capitalize ()
#str4
str4 = "100google is a website"
print str4.capitalize ()
Output
输出量
Hello world, how are you?
Hello world, how are you?
Hello world, how are you?
100google is a website
翻译自: https://www.includehelp.com/python/string-capitalize-method-with-example.aspx
capitalize的用法
今天的文章capitalize的用法_Python字符串| 使用示例的capitalize()方法分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/60980.html