python3.x - python指定utf-8编码的标准写法是什么?
巴扎黑
巴扎黑 2017-04-18 10:15:58
0
5
825

# -*- coding:utf-8 -*-
# coding=utf-8
# encoding: utf-8

为什么很多写法

巴扎黑
巴扎黑

reply all(5)
阿神

PEP0263:
https://www.python.org/dev/pe...

Ty80
# -*- coding: utf-8 -*-
刘奇

Described in https://www.python.org/dev/pe...
pep0263. . .

Ty80

No need to write if you use python3! !

Peter_Zhu

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!