Skip to main content

Posts

Showing posts with the label import your own module in python

Importing modules

What is Python Module? When a Python shell starts it only has access to a basic python functions (“int”, “dict”, “len”, “sum”, “range”, ...) “Modules” that contain additional functionality more methods, more reusability and more sharability. Use “import” keyword to tell the Python shell to load a module. import os, sys Namespaces are one honking great idea -- let's do more of those! (Zen of Python) import this Why importing modules in Python? The major advantage comes when you split your program into several files for easier maintenance. How to import modules in Python A module can be imported by another program to make use of its functionality. This is how we can use the Python standard library as well You can import multiple modules. import module1[, module2[,... moduleN] Normally after module import we can use its containing functions by calling them with refering with the module name followed by period or dot(.) and the function/procedure name. import...