External & built in modules

In Python, modules have a.py extension. Therefore, if a file has the.py extension and contains only plain Python code, it can be regarded as a module. Since the names of the file and module are identical, we can refer to a module solely by name without requiring the extension. In addition, a module can specify variables, classes, and functions.

Modules come in two different varieties.

  1. Built-in
  2. External

Built-in Modules:

Python comes pre-configured with built-in modules. Using the import statement and the specified module name, we may import a module in Python. We can read the Python code contained in the built-in module files by gaining access to them. Each version to Python adds new integrated modules.

External modules:

Unlike built-in modules, which are already existing, external modules must be downloaded from a third party. The command “pip install module name” in the compiler terminal can be used to install them, which is a simple process. Even the finest programmers may find it difficult to become familiar with every module because there are so many of them available. Therefore, we may search for modules that fit our needs and use them as we don’t need to remember them all because we can just look them up online when the need arises.

Being programmers, modules greatly simplify our lives. Since we don’t have to write all the code ourselves, Python makes coding considerably easier than previous programming languages, also referred to as low-level programming languages. Direct access to a module is available for a particular task. For instance, we don’t need to develop our own function with loops and a lot of lines of code in order to generate a random number that falls within its limit of two integers. Instead, we can simply import a module directly, which simplifies the task at hand.

We should not concern ourselves with the code written inside the module; instead, we can search the internet for the functions and properties. If we are not satisfied with the available module’s work or could not find a module that could help us in the required manner, we can create our own module by making a file with .py extension. The module file will be like any other file you see in Python, the difference will just arise in the extension. 

Shubhajna Rai
Shubhajna Rai

A Civil Engineering Graduate interested to share valuable information with the aspirants.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in