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']
> 
> It is not splitted at all.

Use re.split:

 >>> re.split('_| ', s)
['this', 'NP', 'is', 'VL', 'funny', 'JJ']

-- 
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   To love without criticism is to be betrayed.
   -- Djuna Barnes
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to