Posted in python
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>&nbsp;</p>
<p>https://realpython.com/python-web-scraping-practical-introduction/</p>

View Statistics
This Week
81
This Month
478
This Year
425

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

You could also follow me on twitter. I have a couple of youtube channels if you want to see some video related content. RuneScape 3, Minecraft and also a coding channel here Web Dev.

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
"Let us prepare our minds as if we'd come to the very end of life. Let us postpone nothing. Let us balance life's books each day ... The one who puts the finishing touches on their life each day is never short of time."
Seneca
Latest News
## 🚀 AI Giants Hit Bullseye: Anthropic & OpenAI Achieve Product-Market Fit Anthropic and OpenAI have reached a significant milestone, finding product-market fit with their AI technologies, which means their products effectively meet the needs of their customers, driving growth and adoption. This achievement showcases the practical value of their innovations, enabling businesses and individuals to leverage AI for enhanced productivity and efficiency. With this alignment of product and market needs, these companies are poised to transform industries and shape the future of technology.