importEasy Examples

Loads a module or package into the current namespace

Import a module

Importing and using standard library modules.

python
import math
print(math.pi)
print(math.sqrt(144))
print(math.ceil(3.2))

import random
print(random.randint(1, 10))

import os
print(os.name)

import loads a module and makes it available by name. Access its contents with dot notation: module.function().

Want to try these examples interactively?

Open Easy Playground