Unicode Problem

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Thu Oct 30 04:20:08 EDT 2008


On Thu, 30 Oct 2008 10:28:39 +0300, Seid Mohammed wrote:

> I am new to python.
> I want to print Amharic character using the Python IDLE. here goes
> somple code
> ==============================================================
>>>> abebe = 'አበበ በሶ በላ'
>>>> abebe
> '\xe1\x8a\xa0\xe1\x89\xa0\xe1\x89\xa0 \xe1\x89\xa0\xe1\x88\xb6
> \xe1\x89\xa0\xe1\x88\x8b'
>>>> print abebe
> አበበ በሶ በላ
>>>> abeba = ['አበበ','በሶ','በላ'] abeba
> ['\xe1\x8a\xa0\xe1\x89\xa0\xe1\x89\xa0', '\xe1\x89\xa0\xe1\x88\xb6',
> '\xe1\x89\xa0\xe1\x88\x8b']
>>>> print abeba
> ['\xe1\x8a\xa0\xe1\x89\xa0\xe1\x89\xa0', '\xe1\x89\xa0\xe1\x88\xb6',
> '\xe1\x89\xa0\xe1\x88\x8b']
>>>> len(abebe)
> 23
> ========================
> so my question is
> 1)why >>> abebe prints  '\xe1\x8a\xa0\xe1\x89\xa0\xe1\x89\xa0
> \xe1\x89\xa0\xe1\x88\xb6 \xe1\x89\xa0\xe1\x88\x8b' instead of አበበ በሶ በላ
> 2) why >>> print abeba don't print the expected አበበ በሶ በላ string thanks
> a lot.

Because lists represent their content in the `repr()` form.  So you, the 
programmer, can see what's really in there.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list