Strip HTML tags to get strings in python

后端 未结 3 1039
太阳男子
太阳男子 2021-01-21 12:24

I tried to get some strings from an HTML file with BeautifulSoup and everytime I work with it I get partial results.

I want to get the strings in every li element/tag. S

3条回答
  •  孤城傲影
    2021-01-21 13:02

    This example from the documentation gives a very nice one liner.

    ''.join(BeautifulSoup(source).findAll(text=True))
    

提交回复
热议问题