“BS4 Python” Kod odpowiedzi

instaluj instalację BeautifulSoup4

pip install beautifulsoup4
Hurt Hornet

Python BS4 instalacja

pip install bs4 #this'll do the work
SilverShade

Użyj pięknej grupy

#start


from bs4 import BeautifulSoup
import requests

req = requests.get('https://www.slickcharts.com/sp500')
soup = BeautifulSoup(req.text, 'html.parser')
Magnificent Moth

Piękna Klasa Znajdź

mydivs = soup.findAll("div", {"class": "stylelistrow"})
Tommyom

Piękna zupa 4

from bs4 import BeautifulSoup

with open("index.html") as fp:
    soup = BeautifulSoup(fp)

soup = BeautifulSoup("<html>a web page</html>")
arkyyadav001

BS4 Python

soup = BeautifulSoup('<b class="boldest">Extremely bold</b>', 'html.parser')
tag = soup.b
tag.string
# 'Extremely bold'
type(tag.string)
# <class 'bs4.element.NavigableString'>
Successful Spider

Odpowiedzi podobne do “BS4 Python”

Pytania podobne do “BS4 Python”

Więcej pokrewnych odpowiedzi na “BS4 Python” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu