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

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


咨詢(xún)
建站咨詢(xún)
