Last active
August 17, 2022 13:04
-
-
Save defparam/1c06b7988232d21b8057eeb1aa72ef59 to your computer and use it in GitHub Desktop.
Examine a python object
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
def examine(obj): | |
objl = dir(obj) | |
for item in objl: | |
print("%s: %s"%(item.ljust(40," "), type(getattr(obj, item)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Examines an object by iterating through all its attributes , printing them and printing their type.
Useful for printf-style debugging/analysis