lundi 18 décembre 2006

[Python]: Introspection with help()

An article on this subject

Let's say for example I want to integrate a FTP client in my script and I don't want to lose time searching in books or on the web.

Humm, I'm not sure which lib to use ?

>>> help('modules') #gives a list of all the modules

Oh "ftblib" could be useful, lets check

>>> import ftplib
>>> help(ftplib) # gives a description of this module with the classes, etc.

=> the class "FTP" is what I need for the client part

>>> help(ftplib.FTP) # if I just want to see the description of the FTP class

For more informations about 'help' just type help() at the Python prompt.

Another way to find documentation if you are on-line is to use the Python Sidebar in Firefox.

Aucun commentaire: