Created
February 15, 2017 20:52
-
-
Save acdha/44bc255595f8dfd835627c06046e2e56 to your computer and use it in GitHub Desktop.
How to see the modules available in your current local namespace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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