Re: about a head line

2008-04-17 Thread Soltys
Penny Y. pisze:
>  I saw some scripts have a line at its begin:
> 
> # encoding:gb2312
> 
> what's this? Why need it? thanks.
> 

Have a look at PEP-0263 (http://www.python.org/dev/peps/pep-0263/)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: about a head line

2008-04-17 Thread Fivesheep
On Apr 17, 5:54 pm, "Penny Y." <[EMAIL PROTECTED]> 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  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 .
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: about a head line

2008-04-17 Thread Dikkie Dik
Penny Y. wrote:
>  I saw some scripts have a line at its begin:
> 
> # encoding:gb2312
> 
> what's this? Why need it? thanks.
> 

My guess is that it is the automatic work of some sort of editor that
does not understand how encodings work. See what happens if the file was
utf-16le encoded, for example. I think you can safely remove it.
-- 
http://mail.python.org/mailman/listinfo/python-list


about a head line

2008-04-17 Thread Penny Y.
 I saw some scripts have a line at its begin:

# encoding:gb2312

what's this? Why need it? thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list