'How to combine parsing arguments in BeatifulSoup
This is my 1st attempt at scraping right out of the book. I managed to achieve what i needed however I think I can skip 1 step, if I knew how.
import requests
from bs4 import BeautifulSoup as bs
page = requests.get("https://finance.yahoo.com/")
print(page.status_code)
soup = bs(page.content, 'html.parser')
res = soup.find('ul', class_='Carousel-Slider Pos(r) Whs(nw)')
ticker = res.find_all('li')
I think I could combine the last 2 lines, if I knew how....
Any help would be highly appreciated. Ray.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
