Answers for "find links in specific div tag beautifulsoup"

0

find links in specific div tag beautifulsoup

import urllib2
from BeautifulSoup import BeautifulSoup

url = "http://www.gsmarena.com/samsung-phones-f-9-0-p2.php"
text = urllib2.urlopen(url).read()
soup = BeautifulSoup(text)

data = soup.findAll('div',attrs={'class':'makers'})
for div in data:
    links = div.findAll('a')
    for a in links:
        print "http://www.gsmarena.com/" + a['href']
Posted by: Guest on September-25-2021

Code answers related to "find links in specific div tag beautifulsoup"

Browse Popular Code Answers by Language