title: Python: read a text file (each line is of dictionary structure) to a dictionary
body: <p>I am trying to read a file to dictionary, each line is already in a dictionary format:</p>
  
  <p>input.txt:</p>
  
  <pre><code>{u'FirstName': u'John', u'Title': u'Mr', u'LastName': u'Doe'}
  {u'FirstName': u'Mary', u'Title': u'Ms', u'LastName': u'Doe'}
  </code></pre>
  
  <p>I then tried to do the following:</p>
  
  <pre><code>with open("input.txt", "r") as ins:
      for line in ins:
          data = {}
          data = line
          print(data["Title"])
  </code></pre>
  
  <p>Bit I got error:</p>
  
  <pre><code>    &lt;ipython-input-18-a5a5994a6c1d&gt; in main()
           18             data = {}
           19             data = line
      ---&gt; 20             print(data["Title"])
           21 
           22 
  
  TypeError: string indices must be integers, not str
  </code></pre>
  
  <hr>
  
  <p>What did I miss and what's the proper way to read each line of input.txt to a dictionary? Thanks!</p>