Challenge: Read the HTML File
Compito
Swipe to start coding
Open and read the HTML file on your own!
- Import the
urlopen
function from theurllib.request
. - Use the
urlopen()
function to open the page from the specifiedurl
. - Read the page and decode the received bytes object to
"utf-8"
.
Soluzione
99
1
2
3
4
5
6
7
8
9
10
# 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?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 9
99
1
2
3
4
5
6
7
8
9
10
# 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
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione