Jul-22-2018, 10:14 AM
Hi All,
I am trying to collect some info from a website
I use xpath for a specific entry but it doesn't seem to work.
I am trying to collect some info from a website
I use xpath for a specific entry but it doesn't seem to work.
from lxml import html
import requests
headers = {}
headers['User-Agent'] = "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:48.0) Gecko/20100101 Firefox/48.0"
url='https://finviz.com/quote.ashx?t=intc'
url_get = requests.get(url,headers=headers)
tree = html.fromstring(url_get.content)
x = '/html/body/table[3]/tbody/tr[1]/td/table/tbody/tr[7]/td/table/tbody/tr[3]/td[6]/b'
lxml_soup = tree.xpath(x)
print(lxml_soup)unfortunately nothing is printing:Output:[]
