1.

Importing Modules in Python

Answer»

Python has various external libraries of code with useful utilities and functions. To use these modules, we need to import them into our code, using the import keyword.

For example, if we want to use the functionalities of the math module, then we can import it in our python code by using import math as shown in the example below.

import math
print(math.pi)
Output:
3.141592653589793

If we want to perform any string manipulations, we can use the string module as import string in python. More of this is covered in the String Manipulation section below.




Discussion

No Comment Found