python strip html tags like strip_tags in php

Earlier this week I needed to remove some HTML tags from a text, the target string was already recorded with HTML tags in the database and one of the requirement specifies that in some specific page we need to render it as a raw text.

I knew from the beginning that regular expressions could apply for that challenge, but since I am not an expert with regular expressions I looked for some advise in stack overflow and then I found what I actually needed.

Below is the function I have defined:


Also published on Medium.

Leave a Reply

avatar
  Subscribe  
Notify of