매일공부

[python] 문자열인 숫자 판단 본문

Programming/Python

[python] 문자열인 숫자 판단

aram 2023. 6. 20. 15:04

 

isdigit() vs isnumeric() vs isdecimal()

  • isdecimal
    • 10진수만 True
    • Decimal characters are those that can be used to form numbers in base 10
  • isdigit
    • 일반적인 모든 숫자 + 수학적인 함수 포함(분수, 로그 등)
    • 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. 
  • isnumeric
    • 일반적인 모든 숫자 + 수학적인 함수 + 유니코드로 표현가능한 숫자(로마자 등)
    • Numeric characters include digit characters, and all characters that have the Unicode numeric value property

 

참고링크
- https://docs.python.org/3/library/stdtypes.html?highlight=isdecimal#str.isdecimal
- https://datagy.io/python-isdigit/

 

Comments