Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Read the HTML File | Getting Acquainted with HTML
Web Scraping with Python

book
Challenge: Read the HTML File

Compito

Swipe to start coding

Open and read the HTML file on your own!

  1. Import the urlopen function from the urllib.request.
  2. Use the urlopen() function to open the page from the specified url.
  3. Read the page and decode the received bytes object to "utf-8".

Soluzione

# Importing the module
from urllib.request import urlopen

# Opening web page
url = "https://codefinity-content-media.s3.eu-west-1.amazonaws.com/18a4e428-1a0f-44c2-a8ad-244cd9c7985e/page.html"
page = urlopen(url)

# Reading and decoding
web_page = page.read().decode("utf-8")
print(web_page)
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 9
# Importing the module
___

# Opening web page
url = "https://codefinity-content-media.s3.eu-west-1.amazonaws.com/18a4e428-1a0f-44c2-a8ad-244cd9c7985e/page.html"
page = ___(url)

# Reading and decoding
web_page = page.___().___("___")
print(web_page)

Chieda ad AI

expand
ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

some-alt