Python usage numbers

Matej Cepl mcepl at redhat.com
Sun Feb 12 03:14:44 EST 2012


On 12.2.2012 03:23, Steven D'Aprano wrote:
> The use-case given is:
>
> "I have a file containing text. I can open it in an editor and see it's
> nearly all ASCII text, except for a few weird and bizarre characters like
> £ © ± or ö. In Python 2, I can read that file fine. In Python 3 I get an
> error. What should I do that requires no thought?"
>
> Obvious answers:
>
> - Try decoding with UTF8 or Latin1. Even if you don't get the right
> characters, you'll get *something*.
>
> - Use open(filename, encoding='ascii', errors='surrogateescape')
>
> (Or possibly errors='ignore'.)

These are not good answer, IMHO. The only answer I can think of, really, is:

- pack you luggage, your submarine waits on you to peel onions in it 
(with reference to the Joel's article). Meaning, really, you should 
learn your craft and pull up your head from the sand. There is a wider 
world around you.

(and yes, I am a Czech, so I need at least latin-2 for my language).

Best,

Matěj



More information about the Python-list mailing list