title: How to read txt file with tags in Python?
body: <p>I am a beginner in Python. I have a <strong>text file</strong> like below with thousands of docs(from id=1 to id=10000):</p>
  
  <pre><code>&lt;doc id=1&gt;
      &lt;label&gt;1&lt;/label&gt;
      &lt;summary&gt;
          I think you are right
      &lt;/summary&gt;
      &lt;short_text&gt;
          I think you are right. Because I have once read the book in the same topic.
      &lt;/short_text&gt;
  &lt;/doc&gt;
  </code></pre>
  
  <p>Is there any convenient way to read the text file and store the content in instances?</p>
  
  <pre><code>class ShortText:
      def __init__(self, my_id, human_label, summary, short_text):
          self.id = my_id         
          self.human_label = human_label    
          self.summary = summary 
          self.short_text = short_text
      def __str__(self):
          '''
          For printing purposes.
          '''
          return '%d\t%s\t%s\t%s' % (self.id, self.human_label, self.summary, self.short_text)
  
  def load_file(filename):
      #retrieve the original text 
      with codecs.open(filename, encoding='utf-8') as f:
          data = f.read()
      #how to get values from tags and put it below？
          my_id = 
          human_label = 
          summary = 
          short_text = 
          instances[my_id] = ShortText(my_id, human_label, summary, short_text)
      return instances
  </code></pre>