What's the difference between str.isdigit, isnumeric and isdecimal in python?

前端 未结 5 1368
不知归路
不知归路 2020-11-27 13:21

When I run these methods

s.isdigit()
s.isnumeric()
s.isdecimal()

I always got as output or all True, or all False for each value of s (whic

5条回答
  •  一向
    一向 (楼主)
    2020-11-27 13:53

    Related question: which one is equivalent "\d" in regular expression?

    "\d": For Unicode (str) patterns: Matches any Unicode decimal digit (that is, any character in Unicode character category [Nd]). This includes [0-9], and also many other digit characters. If the ASCII flag is used only [0-9] is matched.

提交回复
热议问题