[Tutor] How to iterate through unicode string.
Dirk Wangsadirdja
dirk at pensiun.com
Fri Sep 4 15:14:51 CEST 2009
Hi allen (and perhaps this goes also for others),
just a suggestion, maybe when we post a problem, we should also mention
the python version that we use.
Sometimes, different version of python would give different results.
I tried it with Python 3.1 (python 3.x uses unicode for string) and
Python 2.6.2 (applying the s = u'Büro') and both give me 4 characters.
Sorry, I only have those 2 version installed.
Regards,
Dirk
zhang allen wrote:
> Hi Christian,
>
> Thanks for your tip.
>
> But it seems to me still not working again.
>
> i wirte this python code
>
> k = []
> s = u'Büro'
> for c in s:
> k.append(c)
> print k
>
> k=[u'B', u'\xa8', u'\xb9', u'r', u'o']
>
> i still have 5 different chars.
>
>
More information about the Tutor
mailing list