17 Aug Python Modules
The modules in Python are used to organize the code. We can easily import a module in Python using the import statement. A module can be considered as a file with a code. This module can easily define functions and classes.
Load Module – import and from module import
To load a module in Python, use,
- import statement
- from-import statement
import statement
To import a module in Python, use the import statement,
1 2 3 |
import module1,module2, module3 ... module n |
Example:
1 2 3 |
import math |
from-import statement
To import only the specific attributes of a module, use the from-import statement,
Example:
1 2 3 |
from os import path |
Following are the Python Modules:
No Comments