简体   繁体   中英

Python 3 replacement of string regex

I am working with a html script converted into a string

How do I replace all the html code in tags with blank using regex?

Using a relatively simple pattern (for which it might be a good idea to expand on),

import re
html = re.sub(r'<.+?>', '', html)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM