isdigit() 方法检测字符串是否只由数字组成。
In [5]: str = "123456"; # Only digit in this string
In [6]: print str.isdigit();
True
In [7]:
In [7]: str = "this is string example....wow!!!";
In [8]: print str.isdigit();
False
yuanchenkai 博主文章分类:python和shell ©著作权
isdigit() 方法检测字符串是否只由数字组成。
In [5]: str = "123456"; # Only digit in this string
In [6]: print str.isdigit();
True
In [7]:
In [7]: str = "this is string example....wow!!!";
In [8]: print str.isdigit();
False
上一篇:python中list的赋值处理
下一篇:python中的可变参数
Java检测字符串是否包含数字和字母
这种汉字也是不可以的,返回False**a = "Ⅷ"a.isdigit**这种罗马数字也是不
这里分享两种常用方式来判断字符串全部由数字组成分别是
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M