CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

PYTHON MODULES, PACKAGES, LIBRARIES & FRAMEWORK


PYTHON MODULES, PACKAGES, LIBRARIES & FRAMEWORK

MODULE

1.A module in python is a “.py file” that defines one or more function/classes which you intend to reuse in different codes of your program.
2.To reuse the functions of a given module you simply need to import the module using:
  • import <modulename> # to import the entire module
  • from <modulename> import <functionname> # imports a function from a module
3.Python treats the file name as the module names.

PACKAGES

1.A Python package refers to a directory of Python module(s). This feature comes in handy for organizing modules of one type at one place.
2.A python package is normally installed in:
3.C:\Users\Tanmay\AppData\Local\Programs\Python\Python37\Lib\si te-packages # for windows
4.Python Packages are collection of Modules under the common namespace. This common Name space is created via directory that contains all related modules.
5.NOT ALL folders having multiple .py files (modules) are Packages. An __init__.py (even if empty) file must be a part of the folder.

LIBRARIES

1.It is collection of various packages.
2.Conceptually there is no difference between package and python library.

Some of the commonly used python Libraries :

a..Python Standard Library : Distributed with python. Commonly used modules of Python Standard Library are :
  • math module
  • random module
  • statistics module
b.Numpy Library
c.SciPy Library
d.matplotlib Library
e.tkinter Library

Framework

1.It is a collection of various libraries which architects the code flow.
Ex:- Django . This has various in-built libraries like Auth, user, database connector etc. for web development.

No comments:

Post a Comment