新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:python如何判斷字符是否大寫

創(chuàng)新互聯(lián)建站從2013年開始,先為洛扎等服務建站,洛扎等地企業(yè),進行企業(yè)商務咨詢服務。為洛扎企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務解決您的所有建站問題。
例子:
>>> str_1 = "HELLO python" # 全大寫 >>> str_2 = "Hello PYTHON" # 大小寫混合 >>> str_3 = "Hello Python" # 單詞首字母大寫 >>> str_4 = "hello python" # 全小寫
isupper()判斷是否全是大寫
>>> str_1.isupper() True >>> str_2.isupper() False >>> str_3.isupper() False >>> str_4.isupper() False
islower()判斷是否全是小寫
>>> str_1.islower() False >>> str_2.islower() False >>> str_3.islower() False >>> str_4.islower() True
istitle()判斷首字母是否大寫,其余的是否小寫
>>> str_1.istitle() False >>> str_2.istitle() False >>> str_3.istitle() True >>> str_4.istitle() False
python學習網(wǎng),免費的在線學習python平臺,歡迎關注!
網(wǎng)頁標題:創(chuàng)新互聯(lián)Python教程:python如何判斷字符是否大寫
網(wǎng)站URL:http://www.5511xx.com/article/dpopjhp.html


咨詢
建站咨詢
