Answer the question
In order to leave comments, you need to log in
How to remove empty tags in text using regular expressions?
Good day.
There is a task to clean up the text from unnecessary empty type tags <a></a>, <div class="block"></div>
in the Python language.
How to create a regular expression correctly?
What is the best library to use for cleaning?
If possible a test working example.
Thanks
Answer the question
In order to leave comments, you need to log in
They gave a regular, so you need to put it in re.sub with an empty value of what to change to.
typere.sub(regexp, '', source)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question