How To Retrieve These Elements From A Webpage?
I have a webpage in HTML with these elements:
, { "class" : "content_page" })
>>> for div in alldiv: print div.a
...
<a href="/earth" class="nametessera">earth</a>
<a href="/world" class="nametessera">world</a>
<a href="/planet" class="nametessera">planet</a>
>>> for div in alldiv: print div.a['href']
...
/earth
/world
/plan
Similarly you could also do
allHref = soup.findAll('a', { "class" : "nametessera" })
Solution 2:
You parse the HTML with Beautiful Soup.
The documentation is here.
Post a Comment for "How To Retrieve These Elements From A Webpage?"