Removing span tags from soup BeautifulSoup/Python

前端 未结 3 1146
小蘑菇
小蘑菇 2020-12-16 02:33

I have a soup in Python like this:

Title: Info

&l
3条回答
  •  猫巷女王i
    2020-12-16 03:10

    You'll be wanting to use beautifulsoup's unwrap() for this.

    import bs4
    soup1 = bs4.BeautifulSoup(htm1, 'html.parser')
    for match in soup1.findAll('span'):
        match.unwrap()
    print soup1
    

提交回复
热议问题