sgp
sgp

Reputation: 1768

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?

Upvotes: 16

Views: 14095

Answers (1)

Jared
Jared

Reputation: 26397

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

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

Upvotes: 22

Related Questions