On 10/27/06, Cameron Walsh <[EMAIL PROTECTED]> wrote: > limodou wrote: > > On 10/27/06, Wijaya Edward <[EMAIL PROTECTED]> 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: > > > > str.replace('-', '') > > > Except he appears to want the Chinese characters as elements of the > list, and English words as elements of the list. Note carefully the > last two elements in his desired list. I'm still puzzling this one...
Oh, I see. I made a mistake. -- I like python! UliPad <<The Python Editor>>: http://wiki.woodpecker.org.cn/moin/UliPad My Blog: http://www.donews.net/limodou -- http://mail.python.org/mailman/listinfo/python-list