Why doesn't the Python script understand Unicode?
📁 Advanced Python Topics, AI
"
Script:
#! /usr/bin/env python print ""Привет"" Gives an error:
File ""./y.sh"", line 2 SyntaxError: Non-ASCII character '\\xd0' in file ./y.sh on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for detailsWhat do I need to add to tell the interpreter about the presence of Unicode?
"
Need to add a special comment at the beginning.
#! /usr/bin/env python# -*- coding: utf-8 -*-print ""Hello""
Log in to leave an answer