Posted in python
211
1:11 am, April 4, 2021

python import and print url

here is an example script that imports html from a url and prints it

add it to a .py file and then run it with python3 filename.py

Python

from urllib.request import urlopen
url = "http://olympus.realpython.org/profiles/aphrodite"
page = urlopen(url)
html_bytes = page.read()
html = html_bytes.decode("utf-8")
print(html)

 

https://realpython.com/python-web-scraping-practical-introduction/

python import and print url Demo

View Demo Full Screen View Demo New Tab

python import and print url Code

Related Tags

No Items Found.

Add Comment
Type in a Nick Name here