Htmllib help

axjacob at comcast.net axjacob at comcast.net
Fri Jul 6 02:44:20 EDT 2007


Thank you.

Thats right I don't need the output any where so I don't need to use the writer. I can remove it wowever will the formater work since it needs writer? Maybe I can use the Null writer?




 -------------- Original message ----------------------
From: "Gabriel Genellina" <gagsl-py2 at yahoo.com.ar>
> 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
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list