Skip to content

Instantly share code, notes, and snippets.

@acdha
Created February 15, 2017 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acdha/44bc255595f8dfd835627c06046e2e56 to your computer and use it in GitHub Desktop.
Save acdha/44bc255595f8dfd835627c06046e2e56 to your computer and use it in GitHub Desktop.
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