python script Non-ASCII character

Steve D'Aprano steve+python at pearwood.info
Sun Mar 19 19:20:11 EDT 2017


On Mon, 20 Mar 2017 06:48 am, Xristos Xristoou wrote:

> Τη Κυριακή, 19 Μαρτίου 2017 - 7:38:19 μ.μ. UTC+2, ο χρήστης Xristos
> Xristoou έγραψε:
> 
> how to define my script with  encoding of ISO-8859-7 or  UTF-8?and for the
> blanks ?


First you need to know whether your editor is saving the file using UTF-8 or
ISO-8859-7. What editor are you using?


Set your editor to use UTF-8. That is the best option.

In your script, put:

# -*- coding: utf-8 -*-


as the **very first or second** line of the script. It must be at the
beginning.


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.



More information about the Python-list mailing list