1from requests import get
2from bs4 import BeautifulSoup as bs
3
4page = get("http://website.url/goes-here")
5soup = bs(page.content, 'html.parser')
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')
1li = soup.find('li', {'class': 'text'})
2children = li.findChildren("a" , recursive=False)
3for child in children:
4 print child
1from requests import get
2from bs4 import BeautifulSoup as bs
3
4page = get("http://dataquestio.github.io/web-scraping-pages/simple.html")
5soup = bs(page.content, 'html.parser')
1from bs4 import BeautifulSoup
2soup = BeautifulSoup(html_doc, 'html.parser')
3
4print(soup.prettify())
5# <html>
6# <head>
7# <title>
8# The Dormouse's story
9# </title>
10# </head>
11# <body>
12# <p class="title">
13# <b>
14# The Dormouse's story
15# </b>
16# </p>
17# <p class="story">
18# Once upon a time there were three little sisters; and their names were
19# <a class="sister" href="http://example.com/elsie" id="link1">
20# Elsie
21# </a>
22# ,
23# <a class="sister" href="http://example.com/lacie" id="link2">
24# Lacie
25# </a>
26# and
27# <a class="sister" href="http://example.com/tillie" id="link3">
28# Tillie
29# </a>
30# ; and they lived at the bottom of a well.
31# </p>
32# <p class="story">
33# ...
34# </p>
35# </body>
36# </html>
37