need help of RE
vincent wehren
vincent at visualtrans.de
Sun May 29 04:17:11 EDT 2005
"cheng" <magicmas at spymac.com> schrieb im Newsbeitrag
news:1117352350.179209.206930 at z14g2000cwz.googlegroups.com...
| 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
More information about the Python-list
mailing list