concept urlopen in category data

This is an excerpt from Manning's book Data Science Bookcamp: Five Python Projects.
The Beautiful Soup library allows to easily parse, analyze, and edit HTML documents. In most cases, these documents must be downloaded directly from the web. Lets briefly review the procedure for downloading HTML files, using Python’s built-in
urllibmodule. We’ll start by importing theurlopenfunction fromurllib.request.
The
urlopenfunction is sufficient when downloading a single HTML document from a single, unsecured online page. However, for more complicated downloads, you should consider using the external Requests library. requests.readthedocs.ioListing 16.34. Importing the
urlopenfunctionfrom urllib.request import urlopenGiven the url of an online document, we can download the associated HTML contents by running
urlopen(url).read(). Below, we’ll useurlopento download the Manning website for this book. Afterwards, we’ll print the first 1000 characters of the downloaded HTML.