Python - 070 : package in python
ฝัง
- เผยแพร่เมื่อ 4 ต.ค. 2024
- What is a Python Package?
Python modules may contain several classes, functions, variables, etc. whereas Python packages contain several modules. In simpler terms, Package in Python is a folder that contains various modules as files.
Creating Package
Let’s create a package in Python named mypckg that will contain two modules mod1 and mod2. To create this module follow the below steps:
Create a folder named mypckg.
Inside this folder create an empty Python file i.e. __init__.py
Then create two modules mod1 and mod2 in this folder.