Using Help inside Python

Rhodri James rhodri at
Mon May 4 01:00:42 CEST 2009

On Sun, 03 May 2009 21:21:49 +0100, rose <rose.0978 at> wrote:

> On May 3, 8:15 pm, Steven D'Aprano <st... at REMOVE-THIS-
>> wrote:
>> On Sun, 03 May 2009 07:49:49 -0700, rose wrote:
>> > Hi,
>> >             I have an idea of the basics of programming language in
>> > general. How to access help in python i.e. help followed by something  
>> or
>> > to get to know about some inbuilt module or method etc. how do I  
>> access
>> > help from within the IDLE using the help command.
>> > Thank You.
>> At the prompt, type any of:
>> help()
>> help(module)
>> help(function)
>> help(any_object)
>> help("keyword")  # note the quotes around the keyword
>> then hit Enter to get help about that object or keyword.

> Many Thanks to you Steven, for such a concise explanation of using the
> help. May I request some examples to make it a bit more explicit.

I'll try and expand on Steven's examples a bit, but really

>>> help()

gives you quite a lot of the information anyway.  If you want help on
the "for" keyword, for example, type:

>>> help("for")

(As Steven said, note the quote marks.)  If you want help on anything
else in Python at all, be it a function, module or object, then stick
that object in the brackets.  Thus:

>>> help(123)

tells you all about Python's integers, while

>>> l = [1, 2, 3]
>>> help(l)

tells you about lists.

The only gotcha is that if you try getting help on a string object,
it thinks that you're trying to look up a keyword.  In other words:

>>> s = "for"
>>> help(s)


>>> help("for")

get the same message.

Rhodri James *-* Wildebeeste Herder to the Masses

More information about the Python-list mailing list