how to scrape data from a html page saved locally 1

how to scrape data from a html page saved locally

from bs4 import BeautifulSoup
import html5lib
myFile=open('C:/Users/CSE/AppData/Local/atom/app-1.42.0/practise.html','r')
soup=BeautifulSoup(myFile,"html5lib")
print(soup.prettify())

Here is what the above code is Doing:
1. We open the file in read mode.
2. We create a BeautifulSoup object by passing two arguments:
a. The HTML content
b. The HTML parser we want to use. In our case, we’ll be using html5lib.
3. We use the prettify() function to display the HTML content in a nicely indented manner.

Similar Posts