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

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

print("1234".isnumeric())		#(输出)True
print("1234a".isnumeric())		#(输出)False
print("1234A".isnumeric())		#(输出)False

猜你喜欢

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