Re: Ask how to use HTMLParser

2010-01-10 Thread Nobody
On Fri, 08 Jan 2010 11:44:48 +0800, Water Lin wrote: > I am a new guy to use Python, but I want to parse a html page now. I > tried to use HTMLParse. Here is my sample code: > -- > from HTMLParser import HTMLParser Note that HTMLParser only tokenises HTML; it doesn't actually

Re: Ask how to use HTMLParser

2010-01-08 Thread Dave Angel
Water Lin wrote: h0uk writes: On 8 янв, 08:44, Water Lin wrote: I am a new guy to use Python, but I want to parse a html page now. I tried to use HTMLParse. Here is my sample code: -- from HTMLParser import HTMLParser from urllib2 import urlopen class MyParser(HT

Re: Ask how to use HTMLParser

2010-01-08 Thread h0uk
uot; % attrs[0][1] self.is_title = 1 def handle_data(self, data): if self.is_title: print "here" self.title = data print self.

Re: Ask how to use HTMLParser

2010-01-07 Thread Water Lin
h0uk writes: > On 8 янв, 08:44, Water Lin wrote: >> I am a new guy to use Python, but I want to parse a html page now. I >> tried to use HTMLParse. Here is my sample code: >> -- >> from HTMLParser import HTMLParser >> from urllib2 import urlopen >> >> class MyParser(HTMLParse

Re: Ask how to use HTMLParser

2010-01-07 Thread h0uk
On 8 янв, 08:44, Water Lin wrote: > I am a new guy to use Python, but I want to parse a html page now. I > tried to use HTMLParse. Here is my sample code: > -- > from HTMLParser import HTMLParser > from urllib2 import urlopen > > class MyParser(HTMLParser): >     title = "" >  

Re: Ask how to use HTMLParser

2010-01-07 Thread h0uk
On 8 янв, 08:44, Water Lin wrote: > I am a new guy to use Python, but I want to parse a html page now. I > tried to use HTMLParse. Here is my sample code: > -- > from HTMLParser import HTMLParser > from urllib2 import urlopen > > class MyParser(HTMLParser): >     title = "" >  

Ask how to use HTMLParser

2010-01-07 Thread Water Lin
I am a new guy to use Python, but I want to parse a html page now. I tried to use HTMLParse. Here is my sample code: -- from HTMLParser import HTMLParser from urllib2 import urlopen class MyParser(HTMLParser): title = "" is_title = "" def __init__(self, url):