M
M
mr jeery2017-07-20 17:50:37
Python
mr jeery, 2017-07-20 17:50:37

Why doesn't the help function in Python work?

c7c4c8d3cc4148cbb09df7fc0189bd58.JPGI read about two helper functions dir and help
dir works, help doesn't
>>>S='Spam'
>>>dir(S)
>>>help(S)
Run python interpreter via cmd
I have Python 3.6

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DDDsa, 2017-07-20
@DDDsa

Because you have python 2.7 most likely.
help() :

Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

K
Konstantin Chuvanov, 2017-07-21
@ksamotesov

Works. This is a built-in help, it does not contain information about objects created by the user.

>>> help('spam')
No Python documentation found for 'spam'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.

For a string try:
help(str) # в python3 можно help('')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question