I am having this issue now, so I have a HTMLParser using HTMLParser library class like this
class MyHTMLParser(HTMLParser):
temp = ''
def handle_data(self, data):
MyHTMLParser.temp += data
I need the temp variable because I need to save the data somewhere else so I can assess somewhere else.
My code use the class looks like this:
for val in enumerate(mylist):
parser = HTMLParser()
parser.feed(someHTMLHere)
string = parser.temp.strip().split('\n')
The problem with is that this temp variable is storing whatever I stored it before, it doesn't reset even tho I am declaring a new instance of the parser every single time. How do I clear this variable??? I don't want it to save whatever's there from the previous loop