characters in python

Gigs_ gigs at hi.t-com.hr
Thu Oct 19 05:51:34 EDT 2006


Leo Kislov wrote:
> 
> On Oct 18, 11:50 am, Stens <sgi... at email.t-com.hr> wrote:
>> Stens wrote:
>>> Can python handle this characters: c,c,ž,d,š?
>>> If can how"I wanna to change some characters in text (in the file) to the
>> characters at this address:
>>
>> http://rapidshare.de/files/37244252/Untitled-1_copy.png.html
> 
> You need to use unicode, see any python unicode tutorial, for example
> this one http://www.amk.ca/python/howto/unicode or any other you can
> find with google.
> 
> Your script can look like this:
> 
> # -*- coding: PUT-HERE-ENCODING-OF-THIS-SCRIPT-FILE -*-
> import codecs
> outfile = codecs.open("your output file", "w", "encoding of the output
> file"):
> for line in codecs.open("your input file", "r", "encoding of the input
> file"):
>     outfile.write(line.replace(u'd',u'd'))
> 
thx Leo



More information about the Python-list mailing list