On Fri, Aug 22, 2008 at 4:23 PM, Dotan Cohen <[EMAIL PROTECTED]> wrote:
> 2008/8/22 Lie Ryan <[EMAIL PROTECTED]>:
>> You should also be aware of python's introspection abilities. If you
>> have an object, you could do help(object), dir(object) to get the help
>> file and a dictionary containing the members of the object (if run from
>> a script, you might need to add print statement, e.g. print
>> dir(object) ).
>
> If I know their names :(

Not necessarily. dir(object) will show you the names of the methods of
the object, then you can get help on individual methods. For example
to explore string methods:
dir('') lists all string methods, including e.g. endswith
help(''.endswith) gives help for the endswith method

Also
help(type(''))
gives the help for class str without having to know its name.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to