python file
# -*- coding: utf-8 -*-
print 'original python file'
fix_print.py
class FixPrint(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
simple_stmt< any* bare='print' any* > | print_stmt
"""
def transform(self, node, results):
assert results
bare_print = results.get("bare")
when i use 2to3/lib2to3/fix_print.py to transform the python file.
if i print the node,it shows
# -*- coding: utf-8 -*-
print 'original python file'
why does the node include the annotation “# –– coding: utf-8 –-“
Thank you very much if you can explain this.
New contributor
haifu_qin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.