python
Posted in
329
1:11 am, April 4, 2021
python import and print url
<p>here is an example script that imports html from a url and prints it</p>
<p>add it to a .py file and then run it with python3 filename.py</p>
<h4>Python</h4>
<pre><code class="javascript hljs">from urllib.request import urlopen<br />url = "http://olympus.realpython.org/profiles/aphrodite"<br />page = urlopen(url)<br />htmlbytes = page.read()<br />html = htmlbytes.decode("utf-8")<br />print(html)</code></pre>
<p> </p>
<p>https://realpython.com/python-web-scraping-practical-introduction/</p>
View Statistics
This Week
81
This Month
478
This Year
425
Add Comment
Other Items in python
Related Search Terms
Other Categories in Code
alpine js apps c css factorio font awesome images linux quick modals sqlite site bugs site updates slick slider sliders testing windows apps ai animation apache api apps asp bat blocking bootstrap bootstrap templates charts cookies core css css filters css grid css tips design elements docker domains emoji fancybox fonts foundation framework gimp git html icons ideas image formatting images javascript javascript functions jquery js linux mac minecraft misc modal modals mysql nginx node php php errors php function php functions php simple html dom pi400 proxmox python react regex sections simple_html_dom simplepie php site bugs site documentation slick slick slider sql sqlite ssh sublime svg svg css templates test tools video virtual box vscode vue webdev windows windows 11 windows commands wordpress youtube