Python Dapatkan HTML dari URL
import requests
url = requests.get("http://google.com")
htmltext = url.text
Doubtful Dingo
import requests
url = requests.get("http://google.com")
htmltext = url.text
# 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)
import urllib
link = "http://www.somesite.com/details.pl?urn=2344"
f = urllib.urlopen(link)
myfile = f.read()
print(myfile)