Htmllib help
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Thu Jul 5 21:28:18 EDT 2007
En Thu, 05 Jul 2007 20:23:08 -0300, <axjacob at comcast.net> escribió:
> I am using html and formater as shown below. They are used as part of a
> larger program.
>
> Even though I don't use any print statements, the htmllib seems to be
> throwing parts of the html page on to the standard out(my screen in this
> case). Is there a way to disable the output?
>
> import htmllib
> w = formatter.DumbWriter()
Change the above line. From http://docs.python.org/lib/writer-impls.html:
"class DumbWriter([file[, maxcol = 72]])
Simple writer class which writes output on the file object passed in as
file or, if file is omitted, on standard output."
(From your code fragment it appears that you are not interested in any
output - in that case you don't need the writer at all. And maybe you can
use another parser, like HTMLParser.HTMLParser, so I'd ask why do you use
a writer in the first place?)
--
Gabriel Genellina
More information about the Python-list
mailing list