首页 > 其他 > 详细

字符串方法title()、istitle()

时间:2018-08-16 12:53:27      阅读:128      评论:0      收藏:0      [点我收藏+]

title()、istitle()

语义解释:

title() 方法返回"标题化"的字符串,就是说所有单词的首个字母转化为大写,其余字母均为小写。

istitle() 方法检测字符串中所有的单词拼写首字母是否为大写,且其他字母为小写。

实际运用:

1 a=b=hello  world!
2 print(a.title())
3 print(a.title().istitle())
4 print(b.istitle())

Hello World!
True
False

 

字符串方法title()、istitle()

原文:https://www.cnblogs.com/zc13/p/9486290.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!