What are modules and packages in Python?

Home Forums Software Testing Discussions What are modules and packages in Python?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #25954
    jhon
    Participant
    @richards12

    Hi, I want to know What are modules and packages in Python

    #25959
    Nick
    Participant
    @nickdevelux

    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

     

    Regards, Nick Cooper. Develux

    #26295
    Athira
    Participant
    @athira

    A module is a file containing Python code.

    A package is like a directory containing modules and sub-packages.

    #28398
    Hostle
    Participant
    @hostle-kyle

    Hi, the differences between Python modules and packages can be explained in the following way:

    • On one hand, packages hold the file __init__.py for every user-oriented code. But this does not apply to modules in runtime for any user-specific codes.
    • On the other hand, a module is a file containing Python code in run time for a user-specific code. Every Python module consists of a unit namespace, with the locally extracted variables.

    Hope, it was helpful. Kyle Hostile, Mbicycle

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.