473,322 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

characters in python

Can python handle this characters: ć,č,ž,đ,š?

If can how"
Oct 18 '06 #1
8 2384
Stens wrote:
Can python handle this characters: ć,č,ž,đ,š?

If can how"
Heh, It is from croatian language. So this characters are changed.
Oct 18 '06 #2
Stens wrote:
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>

Oct 18 '06 #3
Stens wrote:
Can python handle this characters: ć,č,ž,đ,š?

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/..._copy.png.html
Oct 18 '06 #4
In <eh**********@ss408.t-com.hr>, Stens wrote:
Stens wrote:
>Can python handle this characters: ć,č,ž,đ,š?

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/..._copy.png.html
Do you want to change the characters in a picture!? Your question still
is *very* vague. Please provide a more detailed description of the
problem at hand.

What do you have? A text file? In which encoding? And what do you want
to achieve?

Ciao,
Marc 'BlackJack' Rintsch
Oct 18 '06 #5


On Oct 18, 11:50 am, Stens <sgi...@email.t-com.hrwrote:
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/..._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'))

Oct 18 '06 #6

Leo Kislov wrote using google groups beta:
On Oct 18, 11:50 am, Stens <sgi...@email.t-com.hrwrote:
Stens wrote:
Can python handle this characters: c,c,,d,?
[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.

Oct 18 '06 #7
I solve it. Just have to do another encoding:
http://www.python.org/dev/peps/pep-0263/
Oct 19 '06 #8
Leo Kislov wrote:
>
On Oct 18, 11:50 am, Stens <sgi...@email.t-com.hrwrote:
>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/..._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
Oct 19 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tetsuo | last post by:
How do I get Python to work with foreign characters? When I try to print them, I get a unicode error (characters not ASCII). Wasn't unicode invented for the express purpose of working with...
2
by: kazuo fujimoto | last post by:
Ricky, I found your message now, because I also would encounter the same problem. Now I am using Hangle with Japaese. What I did is as follow.
2
by: joakim.hove | last post by:
Hello, I am having great problems writing norwegian characters to file from a python application. My (simplified) scenario is as follows: 1. I have a web form where the user can enter his...
29
by: dbhbarton | last post by:
Had a thought that's grown on me. No idea if it's original or not- too inexperienced in programming- but I guess there's no harm floating it out there. Python wins big on readability, and...
3
by: ddtl | last post by:
Hello everybody, I want to create a script which reads files in a current directory and renames them according to some scheme. The file names are in Russian - sometimes the names encoded as...
3
by: sophie_newbie | last post by:
Hi, I want to store python text strings that characters like "é" "Č" in a mysql varchar text field. Now my problem is that mysql does not seem to accept these characters. I'm wondering if there...
0
by: M.-A. Lemburg | last post by:
On 2008-07-01 20:31, Peter Bulychev wrote: You could write a codec which translates Unicode into a ASCII lookalike characters, but AFAIK there is no standard for doing this. I guess the best...
9
by: TP | last post by:
Hi everybody, I am new to Python, I try to understand how Python treats special characters. For example, if I execute the following line in a shell console, I obtain a colored string: $...
7
by: wannymahoots | last post by:
optparse seems to be escaping control characters that I pass as arguments on the command line. Is this a bug? Am I missing something? Can this be prevented, or worked around? This behaviour...
13
by: Liang Chen | last post by:
Hope you all had a nice weekend. I have a question that I hope someone can help me out. I want to run a Python program that uses Tkinter for the user interface (GUI). The program allows me to type...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.