Difference between unicode.isdigit() and unicode.isnumeric()

后端 未结 5 1966
孤城傲影
孤城傲影 2020-12-31 00:37

What is the difference between methods unicode.isdigit() and unicode.isnumeric()?

5条回答
  •  臣服心动
    2020-12-31 01:25

    unicode.isnumeric()
    

    Return True if there are only numeric characters in S, 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.

    str.isdigit()
    

    Return true if all characters in the string are digits and there is at least one character, false otherwise.

    For 8-bit strings, this method is locale-dependent.

提交回复
热议问题