小编mas*_*bro的帖子

在Beautifulsoup Python上排除不需要的标记

<span>
  I Like
  <span class='unwanted'> to punch </span>
   your face
 </span>
Run Code Online (Sandbox Code Playgroud)

如何打印"我喜欢你的脸"而不是"我喜欢打你的脸"

我试过这个

lala = soup.find_all('span')
for p in lala:
 if not p.find(class_='unwanted'):
    print p.text
Run Code Online (Sandbox Code Playgroud)

但它给出了"TypeError:find()不带关键字参数"

html python beautifulsoup web-scraping

8
推荐指数
1
解决办法
9505
查看次数

标签 统计

beautifulsoup ×1

html ×1

python ×1

web-scraping ×1