"cheng" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
| hi all
| a string like
|
| "(word1 & (Word2|woRd3))"
|
| how can i use the re to split it to
|
| ['word1', 'word2', 'word3']
|

import re
s = "(word1 & (Word2|woRd3)"
parts = re.split('\W+', s)
print [p for p in parts if p]

--

Vincent Wehren 


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

Reply via email to