How do I display unicode value stored in a string variable using ord()

MRAB python at mrabarnett.plus.com
Sat Aug 18 14:34:50 EDT 2012


On 18/08/2012 19:05, wxjmfauth at gmail.com wrote:
> Le samedi 18 août 2012 19:28:26 UTC+2, Mark Lawrence a écrit :
>>
>> Proof that is acceptable to everybody please, not just yourself.
>>
>>
> I cann't, I'm only facing the fact it works slower on my
> Windows platform.
>
> As I understand (I think) the undelying mechanism, I
> can only say, it is not a surprise that it happens.
>
> Imagine an editor, I type an "a", internally the text is
> saved as ascii, then I type en "é", the text can only
> be saved in at least latin-1. Then I enter an "€", the text
> become an internal ucs-4 "string". The remove the "€" and so
> on.
>
[snip]

"a" will be stored as 1 byte/codepoint.

Adding "é", it will still be stored as 1 byte/codepoint.

Adding "€", it will still be stored as 2 bytes/codepoint.

But then you wouldn't be adding them one at a time in Python, you'd be
building a list and then joining them together in one operation.



More information about the Python-list mailing list