2 ms·
Note that Python has str.isdecimal, str.isdigit and str.isnumeric. isdecimal isdigit isnumeric 12345 True True Tr
by Veedrac 10y ago
Note that Python has str.isdecimal, str.isdigit and str.isnumeric.
isdecimal isdigit isnumeric
12345 True True True
១2߃໔5 True True True
①²³🄅₅ False True True
⑩⒓ False False True
Five False False False
Use isdecimal if you want to call `int` (though it's EAFTP).
- detaro 10y agoDon't forget to special case negative numbers though.