The shell command curl
and wget
can be called (using os.system
or subprocess.run
)
to download files from internet.
You can also download files using Python modules directly of course.
Hands on the urllib Module in Python
Comments¶
It is suggested that you use the requests module instead of urllib unless you want to have minimal 3rd-party dependencies.
You have to explicit import
urllib.request
in order to use it in Python 3. Please refer to https://bugs.python.org/issue36701 for more discussions. This is how Python 3 intends to work generally speaking. Of course, there are a few exceptions such asos.path