Función help()

La función help() llama al sistema de ayuda que tiene integrado Python. Se utiliza con el interprete en modo interactivo. La estructura de esta función es la siguiente:

help([object])

Veamos que hace cada una de las secciones de la función:

*object es un objeto de Python, puede ser una función, una clase o modulo.

Ejemplo del uso de la función:

help(input)

>>> help(input)
Help on built-in function input in module builtins:
input(prompt=None, /)
Read a string from standard input. The trailing newline is stripped.
The prompt string, if given, is printed to standard output without a trailing newline before reading input. If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError. On *nix systems, readline is used if available.

Si usas la función help() sin argumento se abre la ayuda en modo interactivo. Te darás cuenta del cambio porque en lugar de aparecer los tres símbolos mayor que al inicio (>>>) aparecerá la palabra help (help>). Para salir escribe quit() o presiona Enter.

help()

>>> help()
Welcome to Python 3.8’s help utility!
If this is your first time using Python, you should definitely check out the tutorial on the Internet at https://docs.python.org/3.8/tutorial/.
Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type «quit».
To get a list of available modules, keywords, symbols, or topics, type «modules», «keywords», «symbols», or «topics». Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as «spam», type «modules spam».

help> input
Help on built-in function input in module builtins:
input(prompt=None, /)
Read a string from standard input. The trailing newline is stripped.
The prompt string, if given, is printed to standard output without a trailing newline before reading input. If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError. On *nix systems, readline is used if available.

help>
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type «help(object)». Executing «help(‘string’)»
has the same effect as typing a particular string at the help> prompt.
>>>

Si quieres conocer mas Funciones incorporadas (built-in) te dejo el enlace para regresar al listado completo.

¡No olvides suscribirte a nuestro boletín!

¡No enviamos spam! Lee más en nuestra política de privacidad

1 comentario en «Función help()»

Deja un comentario