Open a webpage using the urllib library

Karthika A
Guvi
Published in
1 min readDec 20, 2019
  • Call the read function on the web URL variable
  • Read variable allows reading the contents of data files
  • Read the entire content of the URL into a variable called request_url
  • Use read method to read the HTML content of the site.
  • Run the code- It will print the data into an HTML format
import urllib.request 
request_url = urllib.request.urlopen(‘https://www.google.com')
print(request_url.read())

--

--