the stupid encoding problem to stdout
Ben Finney
ben+python at benfinney.id.au
Thu Jun 9 19:19:52 EDT 2011
Sérgio Monteiro Basto <sergiomb at sapo.pt> writes:
> Ben Finney wrote:
>
> > In this case your shell has no preference for the encoding (since
> > you're redirecting output to a file).
>
> How I say to python that I want that write in utf-8 to files ?
You already did:
> > In the first print statement you specify the encoding UTF-8, which
> > is capable of encoding the characters.
If you want UTF-8 on the byte stream for a file, specify it when opening
the file, or when reading or writing the file.
--
\ “But Marge, what if we chose the wrong religion? Each week we |
`\ just make God madder and madder.” —Homer, _The Simpsons_ |
_o__) |
Ben Finney
More information about the Python-list
mailing list