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:

defstrip_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"