[Python-Dev] Searching Python docs (Was: Python sidebar for Mozilla/Netscape)

Thomas Heller thomas.heller@ion-tof.com
Thu, 4 Apr 2002 17:35:15 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_018B_01C1DBFF.14E37940
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

> Would it be hard to add a hook to the Python search facility as
> well ?

Inspired by Mark's sidebar I spend a little time to implement a small
script able to search the Python docs. Since it is very small, I post
it here completely.

I'm interested in feedback: Is it usefull at all? Should
something like this go into the Python distribution? How can it be
improved? What should be the user interface - currently it is command
line only and usable from the interactive interpreter programmatically.

The script downloads the index pages of the Python documentation (api,
lib, and ref sections), and parses the HTML code to find all the links.
If only one link is found, it is displayed directly with the webbrowser
module, if more links are found a temporary page is created showing
all these links and displayed.

Command line usage: python pyhelp.py [version] <topic>
version must be 2.0, 2.1, 2.2, or devel
topic is the keyword to search for.

Examples to try:
python pyhelp.py 2.2 Py_Initialize
python pyhelp.py Py_INCREF
python pyhelp.py __i

It is a little bit slow, because it does no caching.

Regards,

Thomas


------=_NextPart_000_018B_01C1DBFF.14E37940
Content-Type: text/plain;
	name="pyhelp.py"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="pyhelp.py"

import htmllib, formatter, string=0A=
import urllib, webbrowser, tempfile, os=0A=
import sys=0A=
=0A=
DOCMAP =3D {=0A=
    "2.0": "http://www.python.org/doc/2.0/",=0A=
    "2.1": "http://www.python.org/doc/2.1/",=0A=
    "2.2": "http://www.python.org/doc/2.2/",=0A=
# Can also use local documentation!=0A=
##    "2.2": "file:c:/python22/doc/",=0A=
    "devel": "[Python-Dev] Python sidebar for Mozilla/Netscape

	
  • Next message: [Python-Dev] Searching Python docs (Was: Python sidebar for Mozilla/Netscape)
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]