beautifulsoup getting data from a website

Solutions on MaxInterview for beautifulsoup getting data from a website by the best coders in the world

showing results for - "beautifulsoup getting data from a website"
Lina
02 Feb 2017
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