Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
REMitchell
GitHub Repository: REMitchell/python-crawling
Path: blob/master/0-Connecting/example2.py
249 views
1
from urllib.request import urlopen
2
from urllib.error import HTTPError
3
from urllib.error import URLError
4
5
try:
6
html = urlopen("https://www.olin.edu/thisschoolsuckssomuch")
7
except HTTPError as e:
8
print(e)
9
except URLError as e:
10
print("The server could not be found!")
11
else:
12
print("It Worked!")
13