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.
Related Contents:
- Where does this come from: -*- coding: utf-8 -*-
- How to modify a text file?
- How to convert a file to utf-8 in Python?
- How to write to .txt files in Python 3
- In Python, how do I decode GZIP encoding?
- Remove very last character in file
- How do I check whether a file exists without exceptions?
- How to read a file line-by-line into a list?
- How do I remove/delete a folder that is not empty?
- Writing a list to a file with Python, with newlines
- Getting file size in Python? [duplicate]
- Directory-tree listing in Python
- How do I watch a file for changes?
- Check if string contains only whitespace
- How to open a file using the open with statement
- How to print bold text in Python?
- Writing a Python list of lists to a csv file
- How to get all of the immediate subdirectories in Python
- Get last n lines of a file, similar to tail
- Python list directory, subdirectory, and files
- Basic http file downloading and saving to disk in python?
- Let JSON object accept bytes or let urlopen output strings
- How to read a file in reverse order?
- Open files in ‘rt’ and ‘wt’ modes
- How to split text without spaces into list of words
- Copy file with pathlib in Python
- FileNotFoundError: [Errno 2] No such file or directory [duplicate]
- Python: How to create a unique file name?
- How to read one single line of csv data in Python?
- How to write UTF-8 in a CSV file
- Get a list of all the encodings Python can encode to
- see if two files have the same content in python [duplicate]
- Save a large file using the Python requests library [duplicate]
- Best method for reading newline delimited files and discarding the newlines?
- How to count the number of words in a sentence, ignoring numbers, punctuation and whitespace?
- Check if a file is not open nor being used by another process
- Size of an open file object
- how to add lines to existing file using python
- In Python, is there a concise way of comparing whether the contents of two text files are the same?
- Error when creating a new text file with python?
- How do I move a file in Python?
- Windows cmd encoding change causes Python crash
- Is there a need to close files that have no reference to them?
- UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 23: ordinal not in range(128)
- How to open an .npz file
- Python logging – check location of log files?
- Efficiently finding the last line in a text file [duplicate]
- Is close() necessary when using iterator on a Python file object [duplicate]
- In Python, how do I iterate over one iterator and then another?
- how to find the owner of a file or directory in python