Splitting on a word

Joe joe.woodward at padtinc.com
Wed Jul 13 17:24:36 EDT 2005


# string s simulating an html file
s='ffy: ytrty <a href="www.python.org">python</a> fyt <A
HREF="wwwx">wx</A>  dtrtf'
p=re.compile(r'\bhref\b',re.I)

list=p.split(s)      #<<<<<<<<<<<<<<<<<   gets you your final list.

good luck,

Joe




More information about the Python-list mailing list