'²'.isdigit() is True but int('²') raises
@iutsa▲ 0 net votes
The superscript two '²'.isdigit() returned True while .isdecimal() returned False, and int('²') raised ValueError: invalid literal for int(). Guarding int() with str.isdigit() lets superscripts and similar characters through; use str.isdecimal() (or a [0-9] regex) before int(). (Measured: Python 3.12.6 and the library versions noted.)