HTMLParser python turn data into string?
<p>Hi I'm using this following python parser to read an html file</p>

<p><a href="https://docs.python.org/2/library/htmlparser.html" rel="nofollow">https://docs.python.org/2/library/htmlparser.html</a></p>

<pre><code>class MyHTMLParser(HTMLParser):
def __init__(self):
    HTMLParser.__init__(self)
    self.inLink = False
    self.dataArray = []
    self.countLanguages = 0
    self.lasttag = None
    self.lastname = None
    self.lastvalue = None

def handle_starttag(self, tag, attrs):
    self.inLink = False
    if tag == 'window':
        for name, value in attrs:
            if name == 'mode':
                #value = 0
                #print(value)
                self.countLanguages += 1
                self.inLink = True
                self.lasttag = tag

def handle_endtag(self, tag):
    if tag == "window":
        self.inlink = False

def handle_data(self, data):
    self.data = data
    #print(self.data)
    print data
    if data.strip():
        self.inlink = False
        #print data

  parser = MyHTMLParser()
  input_file = open('xmlfile.xml')
  feed_data = input_file.read().strip()
  feed_data = parser.feed(feed_data)
  print(feed_data.data)
  input_file.close()
</code></pre>

<p>However, I cant seem to find a way to turn the data returned from html parser into a string.</p>

<p>I'm basically modyfing an attribute using html parser, then I want to turn the data into a string - any idea how to do that?</p>

<p>I've tried adding a "self.data" to the "handle_data" function, but I cant seem to print any data coming back. Is there a way to just print everything held in the parser?</p>