In <[EMAIL PROTECTED]>, 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?

Use the `open()` function in the `codecs` module:

import codecs
f = codecs.open('abc.txt', 'w', 'utf-8')

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to