Get HTML Code of Any Website Using Python

Get HTML Code of Any Website Using Python

  • In this topic we learn how to get HTML code of any website using python.

Module Use

  • Request
  • BeautifulSoup

Need to install


Source Code:

#Follow @Programmerfect

#Get HTML code of any website
#Using Python

import requests
from bs4 import BeautifulSoup

URL = "https://www.programmerfect.com/"
page = requests.get(URL)

soup = BeautifulSoup(page.content, "html.parser")
print(soup.prettify()) 

Output:

 

 

 

Comments