Seid Mohammed wrote:
Welcome! :)
'\xe1\x8a\xa0\x e1\x89\xa0\xe1\ x89\xa0 \xe1\x89\xa0\xe 1\x88\xb6
\xe1\x89\xa0\xe 1\x88\x8b'
አበበበሶ በላ
['\xe1\x8a\xa0\x e1\x89\xa0\xe1\ x89\xa0', '\xe1\x89\xa0\x e1\x88\xb6',
'\xe1\x89\xa0\x e1\x88\x8b']
['\xe1\x8a\xa0\x e1\x89\xa0\xe1\ x89\xa0', '\xe1\x89\xa0\x e1\x88\xb6',
'\xe1\x89\xa0\x e1\x88\x8b']
23
=============== =========
so my question is
1)why >>abebe prints '\xe1\x8a\xa0\x e1\x89\xa0\xe1\ x89\xa0
\xe1\x89\xa0\xe 1\x88\xb6 \xe1\x89\xa0\xe 1\x88\x8b' instead of አበበበሶ
በላ
2) why >>print abeba don't print the expected አበበበሶ በላ string
When you just type an identifier X on the commandline, Python outputs the
result of calling repr(X). This typically gives you something that you
could enter in any Python program. Note that e.g. the string 'አበበበሶ በላ' is
not suitable in any Python program, it requires an encoding where those
characters are supported like e.g. UTF-8.
Now, if you type "print X" on the commandline, it will output the thing as a
string instead, giving you the original contents. If, like for a list, no
string representation exists, it will fall back to using repr() instead.
Disclaimer: I'm not a pro yet myself, but I think this covers the background
a bit. Maybe someone will correct me if I'm horribly wrong.
Uli
--
Sator Laser GmbH
Geschäftsführ er: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
I am new to python.
>>>abebe = 'አበበበሶ በላ'
>>>abebe
>>>abebe
\xe1\x89\xa0\xe 1\x88\x8b'
>>>print abebe
>>>abeba = ['አበበ','በሶ','በላ']
>>>abeba
>>>abeba
'\xe1\x89\xa0\x e1\x88\x8b']
>>>print abeba
'\xe1\x89\xa0\x e1\x88\x8b']
>>>len(abebe)
=============== =========
so my question is
1)why >>abebe prints '\xe1\x8a\xa0\x e1\x89\xa0\xe1\ x89\xa0
\xe1\x89\xa0\xe 1\x88\xb6 \xe1\x89\xa0\xe 1\x88\x8b' instead of አበበበሶ
በላ
2) why >>print abeba don't print the expected አበበበሶ በላ string
result of calling repr(X). This typically gives you something that you
could enter in any Python program. Note that e.g. the string 'አበበበሶ በላ' is
not suitable in any Python program, it requires an encoding where those
characters are supported like e.g. UTF-8.
Now, if you type "print X" on the commandline, it will output the thing as a
string instead, giving you the original contents. If, like for a list, no
string representation exists, it will fall back to using repr() instead.
Disclaimer: I'm not a pro yet myself, but I think this covers the background
a bit. Maybe someone will correct me if I'm horribly wrong.
Uli
--
Sator Laser GmbH
Geschäftsführ er: Thorsten Föcking, Amtsgericht Hamburg HR B62 932