(Sep-16-2019, 03:12 PM)Mark17 Wrote: It looks like a file has been imported:You did import a module when you called
>>> import string
(Sep-16-2019, 03:12 PM)Mark17 Wrote: How does the computer know where to find that file?Python has a predefined series of locations to load modules.
Python first searches the directory the file is ran in. Then searches the PYTHONPATH. Then python searches the standard library directories. Then python searches for directories in a .pth file.
A module is a set of functions, types, classes, ... put together in a common namespace.
A library is a set of modules which makes sense to be together and that can be used in a program or another library.
A package is a unit of distribution that can contain a library or an executable or both. It's a way to share your code with the community.
More info on all that here.
Recommended Tutorials: