I am trying to print the Unicode Bitcoin symbol \u2043
in Python 2. I have tried adding #-*- coding: utf-8 -*-
.
$ python2 -c 'print u'\u0243''
Raises UnicodeEncodeError: 'ascii' codec can't encode character u'\u0243' in position 0: ordinal not in range(128)
. However, doing this from the Python shell works.
$ python2
>>> print u'\u0243'
Ƀ
Why isn't this code working?
bitcoin = u'\u0243'
quote = u'{:,.2f}'.format(float(val), '.2f')
print bitcoin, quote