strip tags python

后端 未结 9 1642
深忆病人
深忆病人 2020-12-17 23:07

i want the following functionality.

input : this is test  bold text  normal text
expected output: this is test normal text
9条回答
  •  感动是毒
    2020-12-17 23:21

    With BeautifulSoup:

    from BeautifulSoup import BeautifulSoup    
    ''.join(BeautifulSoup(page).findAll(text=True))
    

    Found at http://www.ghastlyfop.com/blog/2008/12/strip-html-tags-from-string-python.html

提交回复
热议问题