Excellent question! There are a few options in trying to grok (fully understand) a new library. In your specific case, twitter-scraper, the only function is get-tweets()
and the entire library is under 80 lines long.
For the general case, in decreasing order of usefulness.
- Carefully read the project's description on GitHub. The ReadMe is usually the most carefully written piece of documentation.
- Larger libraries have formatted documentation at http://(package-name).readthedocs.org.
pydoc module_name
works when the module is installed. ``help(module_name)works in an interactive Python session after you have done an
import module_name. These both work from the "docstrings" or strategically placed comments in the source code. This is also what
module_name?` does in iPython.
dir(module_name)
also requires an import. It lists all the entrypoints to the module, including lots of odd "dunder", or double underscore, you would not normally call or change.
- Read the source code. Often, this is easier and more complete than the documentation. If you can bring up the code in an IDE, then jumping around works quickly.
Also, you asked about what can be used within a script:
import os
print("Welcome, human.")
print("dir() is a function, returning a list.")
print("This has no output")
a_list = dir(os)
print("but this does", dir(os))
print("The help() command uses pydoc to print to stdout")
help(os)
print("This program is gratified to be of use.")