Skip to content Skip to sidebar Skip to footer

How To Strip Entire HTML, CSS And JS Code Or Tags From HTML Page In Python

Possible Duplicate: BeautifulSoup Grab Visible Webpage Text Web scraping with Python Say I am a very complex HTML page consisting usual HTML tags, CSS & JS in the middle. We

Solution 1:

Django using this function to strip tags from text:

def strip_tags(value):
    """Returns the given HTML with all tags stripped."""
    return re.sub(r'<[^>]*?>', '', force_unicode(value))

(You won't need the force_unicode part)


Post a Comment for "How To Strip Entire HTML, CSS And JS Code Or Tags From HTML Page In Python"