Modules in Python

Modules in Python: import and the Standard Library, Your Own Modules and Packages.

Updated

  1. import and the Standard Library (Apprentice): Python comes with a standard library of ready-made modules for dice rolls, dates, averages and more, and an import line brings one into your program, whole, by its names, or under a shorter name.
  2. Your Own Modules and Packages (Apprentice): Any .py file is a module another file can import, so a growing program is split into files by job, a folder of them with __init__.py becomes a package, and the __name__ check keeps a file's own test lines from running when it's imported.