Q. What is a library? Write procedure to create own library in Python.


Answer =

A Python library is a reusable chunk of code that is used in program/script using import command. A package is a library if it is install-able or gets attached to site-packages folder of Python installation.

To create own library or package in Python, we should do the following:-

(a) Create a package folder having the name of the package/library.
(b) Add module files (.py files containing actual code functions) to this package folder.
(c) Add a special file _init__.py to it (even if the file is empty).
(d) Attach this package folder to site-package folder of Python installation.

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post