Python has a lot of inbuilt modules but if you want to categorize it then there are three main types of modules in Python:
- Built-in Modules: Python Standard Library (math module)
- External Modules: Installed using pip, Python’s package management tool.
- User-Defined Modules: Files are containd functions, vraibles, etc defined by develper in your Python program.
Complete list:- https://docs.python.org/3/py-modindex.html
Most used types of modules in Python
These Python packages every developer should know and learn:
- NumPy – Basic mathematical operations without any special Python packages.
- Python Imaging Library. …
- MoviePy. …
- Requests. …
- Tkinter. …
- PyQt. …
Custome module example in Python
You can make your own modules and use them. it will help to easily understand code and increasing code resuablity.
Create: Save this code in a file named main.py
var = "Hello main file" num = 9876543210 def greeting(name): print("Hello, " + name)
Import and use: Just use the import statement
import main main.greeting("John") print(main.num)
How many types of modules are there in Python?
Answer: The Python standard library has almost over 200 modules, although the exact number varies between distributions.
Do comment if you have any doubts and suggestions on this Python modules tutorial.
Note: IDE: PyCharm 2021.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.