Python recognizes the following as instruction which defines file's encoding:
# -*- coding: utf-8 -*-
I definitely saw this kind of instructions before (-*- var: value -*-
). Where does it come from? What is the full specification, e.g. can the value include spaces, special symbols, newlines, even -*-
itself?
My program will be writing plain text files and I'd like to include some metadata in them using this format.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…