#Python中检测字符串是否只由数字组成isdigit()

34.(str).isdigit()
检测字符串是否只由数字组成。
如果字符传中只包含数字,返回True 否则返回False

print("123".isdigit())			#(输出)True
print("123a".isdigit())			#(输出)False
print("123B".isdigit())			#(输出)False

猜你喜欢

转载自blog.csdn.net/weixin_43097301/article/details/82962798