Quantcast
Viewing all articles
Browse latest Browse all 3

Answer by vold for Extracting text from link in python

You need to amend your xpath since not all td elements have class="data".Try this xpath expression: //td//text().

import urllibfrom lxml import etreebudgeturl = "http://www.the-numbers.com/movie/budgets/all"s = urllib.urlopen(budgeturl).read()htmlpage = etree.HTML(s)htmltable = htmlpage.xpath("//td//text()")

Output:Image may be NSFW.
Clik here to view.
enter image description here


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>