#Python中检测字符串是否只由大写英文字母或者数字组成issupper()

31.(str).issupper()
检测字符串是否只由大写英文字母或者数字组成。
#如果字符传中至少有一个字符(长度大于1) 且所有的字符都是大写英文字母或者数字返回True,否则返回False。

print("ABC".isupper())			#(输出)True
print("ABC1".isupper())			#(输出)True
print("ABC#".isupper())			#(输出)True
print("ABCa".isupper())			#(输出)False

猜你喜欢

转载自blog.csdn.net/weixin_43097301/article/details/82962784
今日推荐