和④有什么区别?
>>> u''.isdigit()
True
>>> int(u'')
4
>>> u'④'.isdigit()
True
>> int(u'④')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '④'
注意:上面是python3上的输出。在python last上给出了这个例外:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'decimal' codec can't encode character u'\u2463' in position 0: invalid decimal Unicode string