Logo

Programming-Idioms

History of Idiom 137 > diff from v13 to v14

Edit summary for version 14 by programming-idioms.org:
[Python] No need to give sample value

Version 13

2016-09-14, 08:32:37

Version 14

2016-09-14, 20:42:12

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()
Code
b = s.isdigit()
Doc URL
https://docs.python.org/3.5/library/stdtypes.html#str.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