How to find number of characters in a unicode string?

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Fri Sep 29 03:52:28 EDT 2006


In message <pan.2006.09.18.20.29.20.510034 at gmx.net>, Marc 'BlackJack'
Rintsch wrote:

> In <20060918221814.08625ea2.randhol+valid_for_reply_from_news at pvv.org>,
> Preben Randhol wrote:
> 
>> Is there a way to calculate in characters
>> and not in bytes to represent the characters.
> 
> Decode the byte string and use `len()` on the unicode string.

Hmmm, for some reason

    len(u"C\u0327")

returns 2.



More information about the Python-list mailing list