Reading python docs I have come to .isdecimal() and .isdigit() string functions and i'm not finding literature too clear on their usable distinction. Could someone supply me with code examples of where these two functions differentiate please.
There are differences, but they're somewhat rare*. It mainly crops up with various unicode characters, such as
>>> c = '\u00B2' >>> c.isdecimal() False >>> c.isdigit() True
You can also go further down the careful-unicode-distinction rabbit hole with the
>>> c = '\u00BD' # ½ >>> c.isdecimal() False >>> c.isdigit() False >>> c.isnumeric() True
*At least, I've never encountered production code that needs to distinguish between strings that contain different types of these exceptional situations, but surely use cases exist somewhere.