Advertisement
Guest User

Untitled

a guest
Oct 14th, 2015
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import requests, bs4
  2.  
  3. res = requests.get('http://finance.yahoo.com/q/is?s=PG+Income+Statement&annual')
  4. print res.raise_for_status()
  5.  
  6. soup = bs4.BeautifulSoup(res.text, 'html.parser')
  7.  
  8. #css path for the revenues in year 2015 of PG
  9. 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')
  10.  
  11. print elems[0].text.strip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement