Connecting Tech Pros Worldwide Forums | Help | Site Map

Fwd: How to Split Chinese Character with backslash representation?

limodou
Guest
 
Posts: n/a
#1: Oct 27 '06
---------- Forwarded message ----------
From: limodou <limodou@gmail.com>
Date: Oct 27, 2006 11:51 AM
Subject: Re: How to Split Chinese Character with backslash representation?
To: Wijaya Edward <ewijaya@i2r.a-star.edu.sg>


On 10/27/06, Wijaya Edward <ewijaya@i2r.a-star.edu.sgwrote:
Quote:
>
Hi all,
>
I was trying to split a string that
represent chinese characters below:
>
>
Quote:
Quote:
>str = '\xc5\xeb\xc7\xd5\xbc'
>print str2,
???
Quote:
Quote:
>fields2 = split(r'\\',str)
>print fields2,
['\xc5\xeb\xc7\xd5\xbc']
>
But why the split function here doesn't seem
to do the job for obtaining the desired result:
>
['\xc5','\xeb','\xc7','\xd5','\xbc']
>
\xXX just internal representation of None ASCII, I guess above string
is encoded with local locale, maybe gbk. You can get the bytes list
through:

str = '\xc5\xeb\xc7\xd5\xbc'
list(str)

And string is just a list of characters.

--
I like python!
UliPad <<The Python Editor>>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou


--
I like python!
UliPad <<The Python Editor>>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou
Closed Thread