Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests, bs4
- res = requests.get('http://finance.yahoo.com/q/is?s=PG+Income+Statement&annual')
- print res.raise_for_status()
- soup = bs4.BeautifulSoup(res.text, 'html.parser')
- #css path for the revenues in year 2015 of PG
- elems = soup.select('#yfncsumtab > tbody > tr:nth-child(2) > td > table.yfnc_tabledata1 > tbody > tr > td > table > tbody > tr:nth-child(2) > td:nth-child(2) > strong')
- print elems[0].text.strip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement