需求:
将I like <b>bold</b> and <i>italic</i> fonts变为'I like ','bold',' and ','italic',' fonts'
Python:
import re
subject = 'I like <b>bold</b> and <i>italic</i> fonts'
reobj = re.compile("<[^<>]*>")
result = reobj.split(subject)
print result
原文链接:/regex/361668.html