The Python Standard Library
If you are starting to program in Python using the modules, you will soon discover that there are 3 types of modules:
- those you wrote
- those that install from external sources
- those that are already present when you installed Python
All modules belonging to the last type are part of a library called standard library. This library contains many modules, each specialized to perform certain operations.
For example, there is a string module specialized in string manipulation, another that is called datetime that works on time and date values, a module called math that contains many mathematical and random functions that we have seen in the previous sections. But the modules made available in the standard library are very many.
The presence of all these modules has always been one of the strong points of the Python language.
Other modules and libraries with pip
In addition to the standard library there are also many other libraries and modules developed by third parties and which are available for free on the net. Most of these modules are available on the Python Package Index (PyPI). A kind of world repository where all the modules are contained in particular packages that are gradually versioned with each new update. Moreover, this system takes into account the various versions and dependencies that exist between the various packages.
The best way to take advantage of this system of distributing packages and modules is to use a program called pip. This program is automatically installed together with the basic Python distribution.
Whenever you need to install a library (or package) on your package you can do it by typing on the command line:
pip install nome_libreria
and start installing the library and checking for any dependencies. Once the library is installed, you can import the modules by writing the import command.
⇐ Go to Python Lesson 3.7 – Modules
Go to Python Lesson 4.1 – Exceptions ⇒