Skip to content

Instantly share code, notes, and snippets.

@acdha acdha/locals.py
Created Feb 15, 2017

Embed
What would you like to do?
How to see the modules available in your current local namespace
import inspect
import math
print("all local variables:")
print(locals())
print()
print("just the modules:")
print([name for name, value in locals().items() if inspect.ismodule(value)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.