utf-8 read/write file

Benjamin musiccomposition at gmail.com
Wed Oct 8 17:28:26 EDT 2008


On Oct 8, 12:49 pm, Bruno <Br... at hi.t-com.hr> wrote:
> Hi!
>
> I have big .txt file which i want to read, process and write to another .txt file.
> I have done script for that, but im having problem with croatian characters
> (Š,Đ,Ž,Č,Ć).

Can you show us what you have so far?

> How can I read/write from/to file in utf-8 encoding?

import codecs
data = codecs.open("my-utf8-file.txt").read()

> I read file with fileinput.input.
>
> thanks




More information about the Python-list mailing list