Following https://blog.lerner.co.il/pythons-str-isdigit-vs-str-isnumeric/, we have this:
Python 3.8.0a1+ (heads/master:001fee14e0, Feb 20 2019, 08:28:02)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> '一二三四五'.isnumeric()
True
>>> int('一二三四五')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '一二三四五'
>>> float('一二三四五')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: could not convert string to float: '一二三四五'
I think Reuven is right, these should be accepted as input. I just wonder if we should do the same for f.i. roman numerics... |