How to create a package in python?

Packages are directory with some specific classes, functions, etc. which we can use it later as per our convenience. We don’t save all the files in our computer system, so we create packages that are useful for later use and can be imported and used in our programs.
- We have to make directory first with a name suitable for the use.
- Add some specific classes in it.
syantx:-
class class_name1: "class functions" class class_name2: "class functions"
- Now create __init__.py function so that we can import package.
syntax:-
form package_name import function_name . . program in which it is used . .
This is how we can create a package in python.
Subscribe
Login
Please login to comment
0 Discussion