Python istitle() 方法

描述

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

语法

istitle() 方法语法:

S.istitle()

参数

  • 无。

返回值

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

实例

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

#!/usr/bin/python3


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

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

以上实例输出结果如下:

True
False
原文地址:https://www.cnblogs.com/wushuaishuai/p/7686850.html