IT/Python

Python Package, Module, Library 차이

파프양 2021. 4. 14. 23:59
728x90

www.geeksforgeeks.org/what-is-the-difference-between-pythons-module-package-and-library/

 

What is the difference between Python's Module, Package and Library? - GeeksforGeeks

A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

www.geeksforgeeks.org

Module: The module is a simple Python file that contains collections of functions and global variables and with having a .py extension file. It is an executable file and to organize all the modules we have the concept called Package in Python.

Example: Save the code in file called demo_module.py

 

Package: The package is a simple directory having collections of modules. This directory contains Python modules and also having __init__.py file by which the interpreter interprets it as a Package. The package is simply a namespace. The package also contains sub-packages inside it.

 

Library: The library is having a collection of related functionality of codes that allows you to perform many tasks without writing your code. It is a reusable chunk of code that we can use by importing it in our program, we can just use it by importing that library and calling the method of that library with period(.).

Example: Importing pandas library and call read_csv method using alias of pandas i.e. pd.

 

728x90