num = b"1"# byte num.isdigit() # True num.isdecimal() # AttributeError 'bytes' object has no attribute 'isdecimal' num.isnumeric() # AttributeError 'bytes' object has no attribute 'isnumeric'
unicodedata.digit(b"3") # TypeError: must be str, not bytes unicodedata.decimal(b"3") # TypeError: must be str, not bytes unicodedata.numeric(b"3") # TypeError: must be str, not bytes
unicodedata.digit("Ⅷ") # ValueError: not a digit unicodedata.decimal("Ⅷ") # ValueError: not a decimal unicodedata.numeric("Ⅷ") # 8.0
unicodedata.digit("四") # ValueError: not a digit unicodedata.decimal("四") # ValueError: not a decimal unicodedata.numeric("四") # 4.0