characters in python

F

Fredrik Lundh

Stens said:
Can python handle this characters: ć,Ä,ž,Ä‘,Å¡?
yes.

If can how"

depends on the use case: are you trying to put them in source code, in
files, on the terminal, ... ?

</F>
 
L

Leo Kislov


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'))
 
L

Leo Kislov

Leo Kislov wrote using google groups beta:
[snip]

outfile.write(line.replace(u'd',u'd'))

I hope you'll do better than google engeers who mess up croatian
characters in new google groups. Of course the last 'd' should be latin
d with stroke. I really typed it but google swallowed the stroke.
 
G

Gigs_

Leo said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,108
Latest member
AlbertEste
Top