Em mới học python nhưng không biết Sự khác nhau giữa isdigit() và isnummeric() trong python là gì ?
Sự khác nhau giữa isdigit() và isnummeric() trong python là gì
https://docs.python.org/3/library/stdtypes.html#str.isdigit
str.
isdigit
()Return
True
if all characters in the string are digits and there is at least one character,False
otherwise. Digits include decimal characters and digits that need special handling, such as the compatibility superscript digits. This covers digits which cannot be used to form numbers in base 10, like the Kharosthi numbers. Formally, a digit is a character that has the property value Numeric_Type=Digit or Numeric_Type=Decimal.
https://docs.python.org/3/library/stdtypes.html#str.isnumeric
str.
isnumeric
()Return
True
if all characters in the string are numeric characters, and there is at least one character,False
otherwise. Numeric characters include digit characters, and all characters that have the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION ONE FIFTH. Formally, numeric characters are those with the property value Numeric_Type=Digit, Numeric_Type=Decimal or Numeric_Type=Numeric.
Tóm lại là chỉ có convert try-catch mới chuẩn thôi.