Python3 istitle()方法
描述
istitle() 方法檢測字符串中所有的單詞拼寫首字母是否為大寫,且其他字母為小寫。
語法
istitle()方法語法:
str.istitle()
參數(shù)
- 無。
返回值
如果字符串中所有的單詞拼寫首字母是否為大寫,且其他字母為小寫則返回 True,否則返回 False.
實(shí)例
以下實(shí)例展示了istitle()方法的實(shí)例:
#!/usr/bin/python3
str = "This Is String Example...Wow!!!"
print (str.istitle())
str = "This is string example....wow!!!"
print (str.istitle())
以上實(shí)例輸出結(jié)果如下:
True
False
更多建議: