当前位置:首页 > Python教程 > python进阶

Python3 istitle()方法

python3 istitle()方法

python3 字符串

描述

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

语法

istitle()方法语法:

str.istitle()

参数

  • 无。

返回值

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

实例

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

实例

#!/usr/bin/python3 str = "this is string example...wow!!!" print (str.istitle()) str = "this is string example....wow!!!" print (str.istitle())

以上实例输出结果如下:

true
false


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!