发布于 2015-06-21 10:40:40 | 204 次阅读 | 评论: 0 | 来源: 网络整理

istitle()方法检查在字符串中的非casebased字母所有字符是否为大写字母,并且其他字符基于小写。

语法

以下是istitle()方法的语法:


str.istitle()

参数

  • NA

返回值

如果该字符串是一个titlecased字符串,至少有一个字符,比如大写字符,只能跟着无封装字符小写字符此方法返回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
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务