Which modules are loaded?

Easysys Module Programs · 11 of 20

Write a Python program that checks whether a module has been imported yet.

Advertisement
Output
False
True

Approach

  1. sys.modules holds every loaded module.

Solution

Python
import sys print("json" in sys.modules)import jsonprint("json" in sys.modules)
Output
False
True

Learn the concept

New to this topic? Read the lesson, then come back.

More sys module programs

← All 20 sys Module Programs

Leave a Comment