5

What is the difference between and ④?

>>> 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: '④'

Note: above is output on python3. On python last gives this exception:

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
Taha Jahangir
  • 4,774
  • 2
  • 42
  • 49

0 Answers0