I'm beginning my python learning. My python version is 3.1

I‘v never learnt OOP before.
So I'm confused by the HTMLParser

Here's the code:
>>> from html.parser import HTMLParser
>>> class parser(HTMLParser):
def handle_data(self, data):
         print(data)

>>> p = parser()
>>> page = """<html><h1>Title</h1><p>I'm a paragraph!</p></html>"""
>>> p.feed(page)
Title
I'm a paragraph!


I'm wondering if I can pass the data generated by ' handle_data' to a
function instead of just print the data.

Sorry for my poor English
and Thank you for tutoring!
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to