use beautifulsoup
#start
from bs4 import BeautifulSoup
import requests
req = requests.get('https://www.slickcharts.com/sp500')
soup = BeautifulSoup(req.text, 'html.parser')
use beautifulsoup
#start
from bs4 import BeautifulSoup
import requests
req = requests.get('https://www.slickcharts.com/sp500')
soup = BeautifulSoup(req.text, 'html.parser')
how to get element details using cssselector using beautifulsoup
soup.select('div')
All elements named <div>
soup.select('#author')
The element with an id attribute of author
soup.select('.notice')
All elements that use a CSS class attribute named notice
soup.select('div span')
All elements named <span> that are within an element named <div>
soup.select('div > span')
All elements named <span> that are directly within an element named <div>, with no other element in between
soup.select('input[name]')
All elements named <input> that have a name attribute with any value
soup.select('input[type="button"]')
All elements named <input> that have an attribute named type with value button
beautifulsoup find class
mydivs = soup.findAll("div", {"class": "stylelistrow"})
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us