beautifulsoup python

Solutions on MaxInterview for beautifulsoup python by the best coders in the world

showing results for - "beautifulsoup python"
Celia
27 Aug 2016
1pip install beautifulsoup4
Hugo
19 Oct 2018
1pip install bs4 #this'll do the work
Wiley
04 Sep 2016
1#start
2
3
4from bs4 import BeautifulSoup
5import requests
6
7req = requests.get('https://www.slickcharts.com/sp500')
8soup = BeautifulSoup(req.text, 'html.parser')
Sirine
01 Nov 2017
1from bs4 import BeautifulSoup
2
3with open("index.html") as fp:
4    soup = BeautifulSoup(fp)
5
6soup = BeautifulSoup("<html>a web page</html>")
7
Mariana
14 Nov 2016
1import bs4 as bs
2import urllib.request
3
4source = urllib.request.urlopen('https://pythonprogramming.net/parsememcparseface/').read()
Federica
27 Jul 2020
1>>> from bs4 import BeautifulSoup
2>>> soup = BeautifulSoup("<p>Some<b>bad<i>HTML")
3>>> print soup.prettify()
4<html>
5<body>
6<p>
7Some
8<b>
9bad
10<i>
11HTML
12</i>
13</b>
14</p>
15</body>
16</html>
17>>> soup.find(text="bad")
18u'bad'
19>>> soup.i
20<i>HTML</i>
21#
22>>> soup = BeautifulSoup("<tag1>Some<tag2/>bad<tag3>XML", "xml")
23#
24>>> print soup.prettify()
25<?xml version="1.0" encoding="utf-8">
26<tag1>
27Some
28<tag2 />
29bad
30<tag3>
31XML
32</tag3>
33</tag1>
34
similar questions
queries leading to this page
beautifulsoup python