def strip_html_content_to_text(html_content):
 text_content = re.sub('(\\s|&nbsp;|//)+', ' ', html_to_text(html_content))
 text_content = re.sub('<!\\[CDATA\\[.*\\]\\]>', '', text_content)
 text_content = re.sub('<!--.*-->', '', text_content)
 return text_content

def strip_html_content_to_text ( html_content ) : text_content = re . sub ( '(\\s|&nbsp;|//)+' , ' ' , html_to_text ( html_content ) ) text_content = re . sub ( '<!\\[CDATA\\[.*\\]\\]>' , '' , text_content ) text_content = re . sub ( '<!--.*-->' , '' , text_content ) return text_content
gets only the textual part for html content - useful for building text to be searched .