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

book
Challenge: Read the HTML File

Tarefa

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".

Solução

# 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)
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 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)
toggle bottom row
some-alt