def strip_tags(text, strip_punctuation=False):
# Return only the words from content, stripping punctuation and HTML.
soup = BeautifulSoup(text)
if strip_punctuation:
punctuation = re.compile('[{}]+'.format(re.escape(p)))
words_only = punctuation.sub('', soup.get_text())
return words_only
words_only = soup.get_text()
return words_only
评论列表
文章目录