On Oct 14, 2005, at 11:52 PM, Anthony Liu wrote:

I have this simple string:

mystr = 'this_NP is_VL funny_JJ'

I want to split it and give me a list as

['this', 'NP', 'is', 'VL', 'funny', 'JJ']

1. I tried mystr.split('_| '), but this gave me:

['this_NP is_VL funny_JJ']

Try re.split, as in:

import re
re.split('_| ', mystr)

-Jason
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to