zhang allen wrote:
Hi All,
Say i have unicode string * Büro*.
i want to iterate this string .
i write this python code which doesn't work.
s ='Büro'
for ch in s:
print ch
it seems *Büro* has 5 chars. *ü *consists of 2 bytes.
so does someone has any ideas?
how to iterate this string, so i can hava 4 chars, like "B, ü, r, o ".?
Thanks in advance.
--
Best Regards,
Allen
------------------------------------------------------------------------
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
>>> s = 'Büro'
>>> for ch in s:
... print ch
...
B
�
r
o
You need to make it a unicode string.
s = u'Büro'
>>> for ch in s:
... print ch
...
B
ü
r
o
--
Kind Regards,
Christian Witts
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor