Mudanças entre as edições de "Python:Extraindo informações URL"
Ir para navegação
Ir para pesquisar
(Criou página com '= Módulo: urllib = https://docs.python.org/3/howto/urllib2.html https://docs.python.org/3/howto/urllib2.html') |
|||
| Linha 1: | Linha 1: | ||
= Módulo: urllib = | = Módulo: urllib = | ||
[[https://docs.python.org/3/howto/urllib2.html https://docs.python.org/3/howto/urllib2.html]] | [[https://docs.python.org/3/howto/urllib2.html https://docs.python.org/3/howto/urllib2.html]] | ||
| + | |||
| + | == Lendo uma URL == | ||
| + | import urllib | ||
| + | req = urllib.request.Request('https://www.brapci.inf.br') | ||
| + | with urllib.request.urlopen(req) as response: | ||
| + | the_page = response.read() | ||
| + | print(the_page) | ||
Edição atual tal como às 22h41min de 21 de janeiro de 2023
Módulo: urllib
[https://docs.python.org/3/howto/urllib2.html]
Lendo uma URL
import urllib
req = urllib.request.Request('https://www.brapci.inf.br')
with urllib.request.urlopen(req) as response:
the_page = response.read()
print(the_page)