How do I pull

tags without attributes using Beautiful Soup?

后端 未结 1 1044
时光取名叫无心
时光取名叫无心 2021-01-27 00:05

Say a web page contains the following:

相关标签:
1条回答
  • 2021-01-27 00:35

    You can give a lambda to find_all and filter with it.

    soup.find_all(lambda tag: tag.name == 'p' and not tag.attrs)
    
    0 讨论(0)
提交回复
热议问题