Unicode issue with Python v3.3

Lele Gaifax lele at metapensiero.it
Thu Apr 11 06:45:03 EDT 2013


nagia.retsina at gmail.com writes:

> metrites.py tries to open that script so we must tell it to open as
> utf-8 text and not as a binary file.

One way is the following:

    from codecs import open

    with open('index.html', encoding='utf-8') as f:
        content = f.read()

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it  |                 -- Fortunato Depero, 1929.




More information about the Python-list mailing list