+ 1
Python question: Importing modules the purpose of "."
Hi, Online, I saw this import urllib.request Is this having two libraries being imported together? Eg What is the difference between import urllib.request vs import urllib import request
6 Answers
+ 1
urllib is a package and urllib.request is one of the four modules in that package. The documentation fir the urllib package can be found here: https://docs.python.org/3/library/urllib.html
+ 1
If you would like to import the entire package, I believe you can just do:
import urllib
0
urllib.request is a single word. Its the name of a python module that is used to open urls.
0
Ohh right, then is there a difference between urllib vs urllib.request?
0
ok, if I import just urllib then would i get all the four modules? or I need to import all the modules separately?
0
import urllib.request
OR
from urllib import request
are the same