title: Python: How can add words to a list?
body: <p>Okay, the Title is a bit vague, but what I'm trying to do is download data online, parse it and then put the parsed 'data' into an excel file. </p>
  
  <p>I'm getting stuck in trying to put the data into a vector or list. Note that, the data can be either words or numbers. Also, I the length of the data is unknown. I tried the code below:</p>
  
  <pre><code>class MyHTMLParser(HTMLParser):
      def handle_data(self, data):
          d=[]
          d=d.append(data)
  
  parser = MyHTMLParser()
  parser.feed('&lt;html&gt;&lt;head&gt;&lt;title&gt;Test&lt;/title&gt;&lt;/head&gt;'
              '&lt;body&gt;&lt;h1&gt;Parse me!&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;')
  
  d
  
  Traceback (most recent call last):
  File "&lt;pyshell#34&gt;", line 1, in &lt;module&gt;
  d
  NameError: name 'd' is not defined
  </code></pre>
  
  <p>I looked around the forum for an answer, but didn't seem to encounter anything. I am a beginner, so may I'm missing something basic? Thanks, for the help...</p>