forked from SVIG/python-bootcamp
15 lines
644 B
Python
15 lines
644 B
Python
import sys
|
|
|
|
# Iterate through the modules in sys.modules
|
|
for module_name, module in sys.modules.items():
|
|
# Check if the module has a loader attribute
|
|
if hasattr(module, '__loader__'):
|
|
loader = module.__loader__
|
|
# Determine the type of loader
|
|
if type(loader).__name__ == 'SourceFileLoader':
|
|
print(f"Module '{module_name}' has a source loader.")
|
|
elif type(loader).__name__ == 'BuiltinImporter':
|
|
print(f"Module '{module_name}' has a built-in loader.")
|
|
elif type(loader).__name__ == 'ExtensionFileLoader':
|
|
print(f"Module '{module_name}' has an extension loader.")
|