0% found this document useful (0 votes)
8 views19 pages

2.python Modules

Uploaded by

SARIKA NAIR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views19 pages

2.python Modules

Uploaded by

SARIKA NAIR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Modules Structures in Python

Programming

Dr. K.VENKATARAMANA
Associate Professor,
Dept of Computer Science & Systems Engineering
Andhra University

1
What are the Python Modules?

• A Python module is a Python file with .py extension


including statements and definitions. It contains code
that you can reuse in several programs.

• This file can contain a group of classes,


methods, functions and variables.
Python Lists
Different Built – in modules

• A large number of pre-defined functions are also available as a part


of libraries bundled with Python distributions.
• These functions are defined in modules are called built-in modules.
Built-in modules are written in C and integrated with the Python
shell.  Random
 Math
 Time
 Os
 Shutil
 Sys
 Re
 Statistics
Random Module:
Math Module:
Statistics Module:
Date and Time Module:
Date and Time Module:
Time Module:
• The time module in Python provides functions for handling time-related
tasks. The time-related tasks includes, reading the current time, formatting
time, sleeping for a specified number of seconds and so on.
Cont..
OS Module

Sys Module: The sys module provides functions and variables used to
manipulate different parts of the Python runtime environment.
Cont..
re Module
Cont..
re Module
Different ways to import Python Modules
Different ways to import Python Modules
Different ways to import Python Modules
Custom Modules
For example you want to create your own module (custom module) that contains
classes, variables, methods and so on as shown below.
And saved as .py extension
Procedure to execute Custom Modules in Colab
Python Lists

You might also like