characters in python
Leo Kislov
Leo.Kislov at gmail.com
Wed Oct 18 18:46:23 EDT 2006
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'))
More information about the Python-list
mailing list