亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

??

Python 字符串判斷


以下代碼演示了Python字符串的判斷:

# Filename :test.py
# author by : www.shouce.ren

# 測試實例一
print("測試實例一")
str = "shouce.ren"
print(str.isalnum()) # 判斷所有字符都是數(shù)字或者字母
print(str.isalpha()) # 判斷所有字符都是字母
print(str.isdigit()) # 判斷所有字符都是數(shù)字
print(str.islower()) # 判斷所有字符都是小寫
print(str.isupper()) # 判斷所有字符都是大寫
print(str.istitle()) # 判斷所有單詞都是首字母大寫,像標題
print(str.isspace()) # 判斷所有字符都是空白字符、	、
、


print("------------------------")

# 測試實例二
print("測試實例二")
str = "shouce.ren"
print(str.isalnum()) 
print(str.isalpha()) 
print(str.isdigit()) 
print(str.islower()) 
print(str.isupper()) 
print(str.istitle()) 
print(str.isspace()) 

執(zhí)行以上代碼會在該輸出結(jié)果為:

測試實例一
False
False
False
True
False
False
False
------------------------
測試實例二
True
False
False
True
False
False
False

?? ??: ?? ??: