Python Forum
coding: utf-8 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: coding: utf-8 (/thread-11901.html)



coding: utf-8 - Skaperen - Jul-31-2018

you can put # -*- coding: utf-8 -*- in a Python source file to say that the source has UTF-8 encoded characters within. but, what would happen, in the worst cases, if Python treated all source files as if that were used, whether it is actually there or not?


RE: coding: utf-8 - snippsat - Jul-31-2018

The default encoding for Python 3 code is utf-8.
Therefor is no need to use that line in Python 3,i have never used in Python 3.

Only if want to support python2.x in the same file,
or want to use other coding other than utf-8 is that comment needed.