Python modules makes the programming a lot easier.
It’s basically a file that consist of already written code.
When Python imports a module, it first checks the module registry (sys.modules)
to see if the module is already imported.
If that’s the case, Python uses the existing module object as is.
There are different ways to import a module
import sys # access module, after this you can use sys.name to refer to # things defined in module sys. from sys import stdout # access module without qualifying name. # This reads >> from the module "sys" import "stdout", so that # we would be able to refer "stdout" in our program. from sys import * # access all functions/classes in the sys module.
Recommended Python Training
Course: Python 3 For Beginners
Over 15 hours of video content with guided instruction for beginners. Learn how to create real world applications and master the basics.