import

noun

say it: “IM-port” /ˈɪmpɔrt/

A Python statement that brings a module into your file so you can use what's in it, such as import random.

What does import do?

import brings a module into your file so you can use what's in it.

import random
print(random.randint(1, 6))  # a dice roll, like 4

In a sentence

  • “import random gives the file random.randint.”
  • “The first lines of the script import json and csv.”

Level: Apprentice · More Python terms at this level

Updated