about a head line

Fivesheep fivesheep at gmail.com
Thu Apr 17 06:13:45 EDT 2008


On Apr 17, 5:54 pm, "Penny Y." <pyli... at arcor.de> wrote:
>  I saw some scripts have a line at its begin:
>
> # encoding:gb2312
>
> what's this? Why need it? thanks.

declaring of the encoding used in the source file.
it's like <meta http-equiv="Content-type" content="text/html;
charset=gb2312" /> in html

take gb2312 as an example.
you will need it if you have some chinese char in the source file
which uses gb2312 for the file encoding.
if not, you might get an error like:  SyntaxError: Non-ASCII
character .........



More information about the Python-list mailing list