How to Split Chinese Character with backslash representation?
limodou at gmail.com
Fri Oct 27 07:16:01 CEST 2006
On 10/27/06, Wijaya Edward <ewijaya at i2r.a-star.edu.sg> wrote:
> Thanks but my intention is to strictly use regex.
> Since there are separator I need to include as delimiter
> Especially for the case like this:
> >>> str = '\xc5\xeb\xc7\xd5\xbc--FOO--BAR'
> >>> field = list(str)
> >>> print field
> ['\xc5', '\xeb', '\xc7', '\xd5', '\xbc', '-', '-', 'F', 'O', 'O', '-', '-', 'B', 'A', 'R']
> What we want as the output is this instead:
> ['\xc5', '\xeb', '\xc7', '\xd5', '\xbc','FOO','BAR]
> What's the best way to do it?
If the case is very simple, why not just replace '_' with '', for example:
I like python!
UliPad <<The Python Editor>>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou
More information about the Python-list