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