On 05/17/2012 02:15 AM, Steven D'Aprano wrote:

the Fine Manual has more detail, although I admit it isn't *entirely*
clear what it is talking about if you're not a Unicode expert:


http://docs.python.org/py3k/library/stdtypes.html#str.isdecimal

You are right, that is clear, thanks :)

Examples:

py>  c = '\u2155'
py>  print(c)
⅕
py>  c.isdecimal(), c.isdigit(), c.isnumeric()
(False, False, True)
py>  import unicodedata
py>  unicodedata.numeric(c)
0.2

py>  c = '\u00B2'
py>  print(c)
²
py>  c.isdecimal(), c.isdigit(), c.isnumeric()
(False, True, True)
py>  unicodedata.numeric(c)
2.0

Perfect explanation, thanks again, Marco


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to