Answers for "how to read website from url using python"

5

python get html from url

import requests

url = requests.get("http://google.com")
htmltext = url.text
Posted by: Guest on May-10-2020
0

python read url

import urllib

link = "http://www.somesite.com/details.pl?urn=2344"
f = urllib.urlopen(link)
myfile = f.read()
print(myfile)
Posted by: Guest on August-19-2021
1

how to read website from url using python

# Latest code adjusted according to the latest python version
import urllib.request
  	try:
		with urllib.request.urlopen('http://www.python.org/') as f:
			print(f.read().decode('utf-8'))
	except urllib.error.URLError as e:
		print(e.reason)
Posted by: Guest on January-08-2022

Code answers related to "how to read website from url using python"

Python Answers by Framework

Browse Popular Code Answers by Language