BeautifulSoup Not a...
Notifications
Clear all

BeautifulSoup Not able to extract multiple tags in a class

RSS

(@sathish)
Member Moderator
加入:2年ago
Posts: 1391
13/05/2021 12:48 pm

I am trying to extract 2 tags, but I am not able to.

I tried the following to get 1 tag:

fortaginsoup.find_all('a'): print (tag.text)

But when I try this for 2 tags, it doesn't work.

fortaginsoup.find_all('a','div'): print (tag.text)

Quote
(@anamika)
Noble Member
加入:2年ago
Posts: 1381
13/05/2021 12:49 pm

You are missing the square braces. You have to pass an array. Try this:

fortaginsoup.find_all(['a','div']): print (tag.text)


ReplyQuote
Share:
Baidu