[Tutor] (no subject)

Alan G alan.gauld at freenet.co.uk
Fri Aug 26 00:17:33 CEST 2005


> What is the best way to split a unicode string in its characters? 
> Specifically, having this unicode chinese string
> 
> u'\u8C01\u4ECA\u5929\u7A7F\u4EC0\u4E48
> 
> I want to either split all its characters:
> [\u8C01,\u4ECA,\u5929,\u7A7F,\u4EC0,\u4E48]
> 

>>> s = u'\u8C01\u4ECA\u5929\u7A7F\u4EC0\u4E48'
>>> list(s)
[u'\u8c01', u'\u4eca', u'\u5929', u'\u7a7f', u'\u4ec0', u'\u4e48']
>>>


What seemed to be the problem? Or am I missing something?

Alan G.


More information about the Tutor mailing list