html renderer

Thomas Guettler guettli at thomas-guettler.de
Mon Nov 17 09:58:25 EST 2003


Am Sun, 16 Nov 2003 06:10:04 -0800 schrieb Michele Simionato:

> I am looking for a textual html renderer (such as lynx) to be
> called from a Python program. The only needed functionality is 
> the following: passing to it a string it should show the html file at 
> the first match of the string (it does not seem obvious to do it with
> lynx, please correct me if I am wrong). Essentially, I want to be able to
> to browse rapidly over a bunch of html files. Fancy graphics is not
> important, easy of use is very important. Portable solutions are
> better, but a Linux only solution would be good enough.

Hi,

may be this helps:

# untested
fd=os.popen("lynx -dump foo.html")
content=fd.read()
fd.close()
idx=content.find("yourtext")
print content[idx-20:idx+20]

 thomas





More information about the Python-list mailing list