Python — Modules

The tool allows you to easily customize your Python code. The code’s code-related code that makes the easy-to-understand and easy-to-use code. The module is a Python object with unimaginable attributes that can be included.

Simply, the module is a file of the Python code. The tool determines the activity, grades, and variables. The device can be in the executable number.

For example

The name of the Python code module is typically called a file called Here is an example of a simple module,

def print_func( par ):

print “Hello: “, par


The import Statement

You can use any file like Python sources by performing the proof of Python’s papers. download after posting -

From the sentence

import module1[, module2[,… moduleN]

The from…import Statement

The Python Decree for people will allow you to download the special features of the module in your current name. … the following introductory songs are:

proof of import

from modname import name1[, name2[, … nameN]]

The from…import * Statement

It is also possible to import all the cellphone names from the domain name right now using the following state quotation -

from modname import *

Locating Modules

If you download the module, you are looking for a Python translation section to download -

• Current record.

• If the module is not available, Python detects all PYTHONPATH variables.

• If all of them fail, check the Python standard. On UNIX, the standard line is normally / usb / local / lib / python /.

The garbage collection unit is stored in the sys sys sys sys syndrome. The sys.path variable is currently in the current record, PYTHONPATH and the standby rate.

Change pythonpath

PYTHONPATH is a local change, consisting of a list of calls. PYTHONPATH is the same as the shell changes.

set PYTHONPATH = c:\python20\lib;

Here is PYTHONPATH has a Windows system

set PYTHONPATH = /usr/local/lib/python

Name and size

A change is a name (identification) that is assigned to objects. The name of the letters is the name of the translators (keys) and their equivalents.

Python releases may require local variable names for the domain name and generic name. When local and international transfers have the same name, local changes change in the world.

Every task has its own name. Class sizes follow the same rules for routine activities.

Python makes no doubt about whether a change is either locally or internationally. It is believed that all the variables are valuable to local activities.

Therefore, to allocate value to a general change of work, you must first use this international statement.

NameThe international text says Python in VarName is a global change. Python stops tracking names, pores inside.

For example, we created the confidentiality of the domain name. The money is paid for a fee, which Python thinks about the local currency variable. However, we have received a lot of money in advance, so the result is UnboundLocalError. The transcript of action determines international problems.

The dir( ) Function

The generated dynamic dir () returns to the order list in the names defined in the module.

a list of the names of all sectors, variables and activities described in the section. The following is a simple example -

International and domestic impact () ()

The globals() and locals() Functions

Global () and Internal Trigger () Functions can be used to restore the domain name and local name, depending on where they call.

If the construction work () is one, it will go to all the names that are available in the environment.

The reload() Function

If the task of international alteration () is declared one, it will go to all the names that are available in international activities.

Both types return to the word. Therefore, the name can be removed from the action key ().


When the subjects are exported to a high-quality code to complete once.

Therefore, if you want to go back to the advanced code module, you can use the weather (). Function load () draws the program before it is delivered. The word for the load () is


To getting expect level training for Python training in your Location — Python training in Chennai | Python training in Bangalore | Python training in Pune | Python training in Velachery | Python training in Tambaram | Python training in Marathahalli | Python training in btm.

Like what you read? Give queen merlin a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.