Tools to open .py files as Unicode, using the encoding specified within the file, as per PEP 263.
Much of the code is taken from the tokenize module in Python 3.2.
Read a Python file, using the encoding declared inside the file.
Parameters : | filename : str
skip_encoding_cookie : bool
|
---|---|
Returns : | A unicode string containing the contents of the file. : |
Read a Python file from a URL, using the encoding declared inside the file.
Parameters : | url : str
errors : str
skip_encoding_cookie : bool
|
---|---|
Returns : | A unicode string containing the contents of the file. : |
Generator to pull lines from a text-mode file, skipping the encoding cookie if it is found in the first two lines.