Python Forum

Full Version: Trivial novice question: information gathering tools in Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am enrolled in a number of learn-to-code Python Udemy courses. I can’t find the specific tutorial now which covered the different type of built in functions that Python developers have available to them in the Python shell. The only one I remember is type(), where you can enter a parameter such as a variable and then the interpreter returns “str” or “int” or “boolean”, depending on what kind of variable it is. There are similar common tools or functions which will show the docstring (and other information) of builtin functions and methods right in the Python interpreter, without having to look up official documentation on Python’s official website in your web browser. Does anyone know what I a referring to? There are at least 2 more “information gathering” commands but I can’t for the life of me remember what they are called.

I am really not looking forward to sifting through all 25+ hours worth of course content just to find out these essential operations. It’s like finding a needle in a haystack.

I obviously resorted to Google (with the intention of finding the most relevant Stackoverflow answer) but I am having trouble finding the right search terms. For example, I tried searching for term combinations including:
  • ‘python tools for detail methods’
  • ‘python builtin gathering functions’
  • ‘python type function similar’
(and variations)

But I am just not using the right search terms.

I realize my initial question will have a trivial answer.

Even though I feel like I haven’t done the best job explaining, I hope that some forum member knows what I am trying to get at.

Found it!

Here are the functions I was thinking of:
dir()
help()
type()
__doc__
Quote:where you can enter a parameter such as a variable and then the interpreter returns “str” or “int” or “boolean”,
print(type(variablename))
if you have python interpreter loaded, use:
if for external package, import package first, then
help(packagename) where name can be package name,, function, etc.
example:
>>> import tkinter

>>> help(tkinter)
...
>>> help(tkinter.grid)