Logo

Programming-Idioms

History of Idiom 137 > diff from v12 to v13

Edit summary for version 13 by cons0l3:
New Python implementation by user [cons0l3]

Version 12

2016-09-09, 21:36:39

Version 13

2016-09-14, 08:32:37

Idiom #137 Check if string contains only digits

Set boolean b to true if string s contains only characters in range '0'..'9', false otherwise.

Idiom #137 Check if string contains only digits

Set boolean b to true if string s contains only characters in range '0'..'9', false otherwise.

Code
s = "013221321"
b = s.isdigit()
Doc URL
https://docs.python.org/3.5/library/stdtypes.html#str.isdigit
Origin
https://docs.python.org/3.5/library/stdtypes.html#str.isdigit