In [1]:
import urllib

In [2]:
print(type(urllib))


<class 'module'>

In [3]:
print(urllib)


<module 'urllib' from '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/__init__.py'>

In [4]:
# print(urllib.error)
# AttributeError: module 'urllib' has no attribute 'error'

In [5]:
import urllib.error

In [6]:
print(urllib.error)


<module 'urllib.error' from '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/error.py'>

In [7]:
print(urllib.error.HTTPError)


<class 'urllib.error.HTTPError'>

In [8]:
from urllib import error

In [9]:
print(error)


<module 'urllib.error' from '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/error.py'>

In [10]:
print(error.HTTPError)


<class 'urllib.error.HTTPError'>

In [11]:
from urllib.error import HTTPError

In [12]:
print(HTTPError)


<class 'urllib.error.HTTPError'>