Re: unicode text file

2009-10-03 Thread Junaid
On Sep 27, 6:39 pm, "Mark Tolonen" wrote: > "Junaid" wrote in message > > news:0267bef9-9548-4c43-bcdf-b624350c8...@p23g2000vbl.googlegroups.com... > > >I want to do replacements in a utf-8 text file. example > > > f=open("test.txt","r") #this file is uft-8 encoded > > raw = f.read() > > txt = ra

Re: unicode text file

2009-09-27 Thread Mark Tolonen
"Junaid" wrote in message news:0267bef9-9548-4c43-bcdf-b624350c8...@p23g2000vbl.googlegroups.com... I want to do replacements in a utf-8 text file. example f=open("test.txt","r") #this file is uft-8 encoded raw = f.read() txt = raw.decode("utf-8") You can use the codecs module to open and d

Re: unicode text file

2009-09-27 Thread MRAB
Junaid wrote: I want to do replacements in a utf-8 text file. example f=open("test.txt","r") #this file is uft-8 encoded raw = f.read() txt = raw.decode("utf-8") txt.replace{'English', ur'ഇംഗ്ലീഷ്') #replacing raw unicode string, but not working txt = txt.replace{'English', ur'ഇംഗ്ലീഷ്') f

Re: unicode text file

2009-09-27 Thread Vlastimil Brom
2009/9/27 Junaid : > I want to do replacements in a utf-8 text file. example > > f=open("test.txt","r") #this file is uft-8 encoded > > raw = f.read() > txt = raw.decode("utf-8") > > txt.replace{'English', ur'ഇംഗ്ലീഷ്') #replacing raw unicode string, > but not working > > f.write(txt) > f.close() >