python3 capitalize()方法
描述
python capitalize() 将字符串的第一个字母变成大写,其他字母变小写。
语法
capitalize() 方法语法:
str.capitalize()
参数
- 无。
返回值
该方法返回一个首字母大写的字符串。
实例
以下实例展示了 capitalize() 方法的实例:
实例
#!/usr/bin/python3
str = "this is string example from 51frw....wow!!!"
print ("str.capitalize() : ", str.capitalize())
str = "this is string example from 51frw....wow!!!"
print ("str.capitalize() : ", str.capitalize())
以上实例输出结果如下:
str.capitalize() : this is string example from 51frw....wow!!!
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!