string.istitle()

收藏:0   阅读:58

Python istitle()方法


描述

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

语法

istitle()方法语法:

str.istitle()

参数

返回值

如果字符串中所有的单词拼写首字母是否为大写,且其他字母为小写则返回 True,否则返回 False.

实例

以下实例展示了istitle()方法的实例:

#!/usr/bin/python


str = "This Is String Example...Wow!!!";
print str.istitle();

str = "This is string example....wow!!!";
print str.istitle();

以上实例输出结果如下:

True
False

© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!