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
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