# -*- coding: utf-8 -*-
I understand that this line of code is necessary when non-ascii characters are involved in python script file.
When I was learning python, I was told that the two ways of running python code (line by line in interpreter vs run a script file) would yield the same result. And they actually do, in most cases. But when non-ascii characters involved in scripts, it turns out that I have to declare encoding first.
Moreover, I have tried exec() function, trying to execute a string containing python codes.
>>> exec ("b='你'")
But if I save "b = '你'" to a script and run it, I will get syntax error.
I am curious about why I don't need to declare encoding when running python codes line by line in interpreter.
Is there any difference in executing procedures of these two way?