title: Import dictionary from txt file
body: <p>I have a function <code>CalcPearson</code> that needs 2 dictionaries as input. The dictionaries are in txt files in the following format:</p>
  
  <pre><code>(22, 0.4271125909116274)
  (14, 0.4212051728881959)
  (3, 0.4144765342960289)
  (26, 0.41114433561925906)
  (39, 0.41043882384484764)
  .....
  </code></pre>
  
  <p>How can I import the data from the files as dictionaries? Do I need to modify them or there is a simple function for this?</p>
  
  <p>I tried with this code:</p>
  
  <pre><code>inf = open('Route_cc.txt','r')
  inf2 = open('Route_h2.txt','r')
  d1 = eval(inf.read())
  d2 = eval(inf2.read())
  print(calcPearson(d1,d2))
  inf.close()
  </code></pre>
  
  <p>But I got an invalid syntax error at the second row of the first file that the code opened so I think I need a particular syntax in the file. </p>