PYTHON QUESTION: List four methods of the built-in HTMLParser class. For each, s
ID: 3858781 • Letter: P
Question
PYTHON QUESTION: List four methods of the built-in HTMLParser class. For each, specify (a) the number of parameters it takes; and (b) the types of data that should be passed to it. Do not include self.
i. Method is passed parameters:
ii. Method is passed parameters:
iii. Method is passed parameters:
iv. Method is passed parameters:
For example, let's say that you think foo is a method of this class (it is not). Then you would fill in one of the above with something like:
EXAMPLE: Method foo is passed 2 parameters: a string and an integer THE IN BOLD IS WHAT WE NEED TO FILL IN 1-iv. METHODS IN THE HTMLParser class
Explanation / Answer
HTMLParser.feed(data) - data can be either unicode or str HTMLParser.handle_starttag(tag, attrs) - tag is the name of the tag in lower case i.e type str .ttrs argument is a list of (name, value) pairs containing the attributes found inside the tag’s brackets. HTMLParser.handle_endtag(tag) - tag is the name of a tag in lower case i.e type str HTMLParser.close() - It wont take any parameters HTMLParser.reset() - It wont take any parameters HTMLParser.getpos() - It wont take any parametersRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.