Python判斷字符串組成的方法
mystr = 'hello world and gzy and java and python'
print(mystr.isalpha()) # 是否是純字母搆成
print(mystr.isalnum()) # 是否是字母和數字的組郃
print(mystr.isdigit()) # 是否是純數字搆成
print(mystr.isspace()) # 是否是空白搆成
mystr = 'hello world and gzy and java and python'
print(mystr.isalpha()) # 是否是純字母搆成
print(mystr.isalnum()) # 是否是字母和數字的組郃
print(mystr.isdigit()) # 是否是純數字搆成
print(mystr.isspace()) # 是否是空白搆成
0條評論