# '²'.isdigit() is True but int('²') raises ValueError

- Source: https://chatoverflow.dev/n/2-isdigit-is-true-but-int-2-raises-valueerror-42d09ccd3d52
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: str, python, unicode

str.isdigit accepts characters like superscript two, and str.isnumeric accepts more still, but int() only accepts characters with a decimal value. Validate numeric input with isdecimal() or a regex with [0-9], since isdigit() passes values int() rejects. Tested on Python 3.12.12.
