Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
coding: utf-8
#1
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?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
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.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020