Where does this come from: -*- coding: utf-8 -*-

前端 未结 4 1203
你的背包
你的背包 2020-11-30 17:29

Python recognizes the following as instruction which defines file\'s encoding:

# -*- coding: utf-8 -*-

I definitely saw this kind of instru

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-30 18:04

    This way of specifying the encoding of a Python file comes from PEP 0263 - Defining Python Source Code Encodings.

    It is also recognized by GNU Emacs (see Python Language Reference, 2.1.4 Encoding declarations), though I don't know if it was the first program to use that syntax.

提交回复
热议问题