I'm a beginner at Python. I know Python annotations are there to explain how to organize code that doesn't help coding at all like C, but to encode text as utf-8 when thrusting it
# -*- coding: utf-8 -*-
# # UTF-8 encoding when using korean
# # -*- coding:cp949 -*-*
You need to write these codes. Why do you do it while doing #?!?! Isn't it annotated?
#-*-*-
Does this have a special meaning?
It is defined in the Python specification.
When encoding, the first or second line says to match the format you wrote in the question.
To be exact, write down the form ^[\t\v]*#.*?coding[:=][\t]*([-.a-zA-Z0-9]+)
.
https://www.python.org/dev/peps/pep-0263/
© 2024 OneMinuteCode. All rights reserved.