How to install beautifulsoup

Photo by BAB2056 on Pexels.com

This article is about installing Beautifulsoup. It is a Python library, which can scrape webpages and parse the HTML code.

Please check the prerequisites before starting.

  • python
  • pip

You can install Beautifulsoup by following these steps:

  1. open the command line and run the pip install command
pip install beautifulsoup4

2. Test Beatifulsoup by testing the following script in the python interpreter

from bs4 import BeautifulSoup

html_doc = """
<div><h1>quick start beautifulsoup :)</h1></div>
"""

soup = BeautifulSoup(html_doc, 'html.parser')

print(soup.prettify())

you’ll see the HTML tag element has been formatted beautifully

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s