[Tutor] python3 - °F/°C printing those degree signs

Evuraan evuraan at gmail.com
Tue Aug 7 23:43:53 EDT 2018


>
> You could try setting
>
> PYTHONIOENCODING="UTF-8"
>
> in your OS shell and see if that helps, but I suspect
> there's a better way to deal with it...
>

Thank you! That was it!

Exporting thusly made it behave:

$ export PYTHONIOENCODING="UTF-8"
$ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('\u00b0'+ "F")
°F
>>>

I've come across this env variable even before, but overlooked it this
time again. Much appreciated!


More information about the Tutor mailing list