how to control file output encoding?
Peter Otten
__peter__ at web.de
Wed Sep 20 02:10:15 EDT 2006
MaTianyi wrote:
> the encoding of file that is output by the file.write() function is
> always None.
> and the encoding attribute of the File Object is readonly.
>
> f = open('abc.txt','w')
> print f.encoding
> >>> None
>
> how can I change the file output encoding?
Have a look a the codecs module. codecs.open() will do the job.
http://docs.python.org/dev/lib/module-codecs.html
Peter
More information about the Python-list
mailing list