Python equivalent of "lynx -dump"?

ben at ben at
Mon Mar 27 23:45:06 CEST 2000

lewst <lewst at> wrote:
> I'm looking for a functional equivalent of the "-dump" option to the
> lynx web-browser in Python.  "-dump" dumps the formatted output of an
> HTML document.

> Right now I have a python program that captures the output of a
> webpage and prints it like so:

>         lynxcmd = "lynx -dump %s" %url
>         data = os.popen(lynxcmd).read()
>         print data

An all Python solution is a little bit more complicated:

import htmllib, formatter 

p = htmllib.HTMLParser(formatter.AbstractFormatter(formatter.DumbWriter()))
f = open('test.html')

If you want a writer who knows how to write lists (<ol>), look for a message
called LessDumbWriter posted last friday (by me).

ben . de . rydt at pandora . be ------------------ your comments ------- inl. IPv6, Linux en Pandora

More information about the Python-list mailing list