Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # I like using pprint function for printing stuff as makes more human readble
- from pprint import pprint
- # Importing os library for example
- import os
- # for a module object: the module's attributes.
- # for a class object: its attributes, and recursively the attributes of its bases.
- # EXAMPLE: Print all the modules of os and os.walk
- pprint (dir(os))
- pprint(dir(os.walk))
- # This is another way to get information about an object's module and atrributes
- # I like this better as this will give you a better sense of if the method of an object is actually a functions or an attribute
- # The means I find out easier if I need to use () and pass some arguments or I don't need to use parantesies and it's just an attributes
- # This also show where this module lives on disk and more
- pprint(help(os))
- # EXAMPLE: print an attribute of an object
- pprint(os.name)
- # EXAMPLE: print an method of an object
- pprint(os.times())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement