# -*- coding:utf-8 -*- # coding=utf-8# encoding: utf-8
# -*- coding:utf-8 -*-
# coding=utf-8
# encoding: utf-8
为什么很多写法
PEP0263:https://www.python.org/dev/pe...
# -*- coding: utf-8 -*-
Described in https://www.python.org/dev/pe... pep0263. . .
No need to write if you use python3! !
There are indeed many ways to write, the ones given by the questioner are all acceptable, the first two are more common
But as long as it meets the following rules:
^[ \t\v]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)
Note: When writing, there are no spaces or tabs between coding and the equal sign and colon
PEP0263:
https://www.python.org/dev/pe...
Described in https://www.python.org/dev/pe...
pep0263. . .
No need to write if you use python3! !
There are indeed many ways to write, the ones given by the questioner are all acceptable, the first two are more common
But as long as it meets the following rules:
Note: When writing, there are no spaces or tabs between coding and the equal sign and colon