Python usage numbers
mcepl at redhat.com
Sun Feb 12 09:26:57 CET 2012
On 12.2.2012 09:14, Matej Cepl wrote:
>> 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,
Slightly less flameish answer to the question “What should I do,
really?” is a tough one: all these suggested answers are bad because
they don’t deal with the fact, that your input data are obviously
broken. The rest is just pure GIGO … without fixing (and I mean, really,
fixing, not ignoring the problem, which is what the previous answers
suggest) your input, you’ll get garbage on output. And you should be
thankful to py3k that it shown the issue to you.
BTW, can you display the following line?
Příliš žluťoučký kůň úpěl ďábelské ódy.
More information about the Python-list