title: eval lines from a file
body: <p>I am creating a program that stores options in a txt file, and I tried a few different lines but so far I think an <code>eval</code> is the best one.</p>
  
  <p>I got this info in the file:</p>
  
  <pre><code>colordefondo = "#abcdef"
  </code></pre>
  
  <p>and I got this <code>eval</code> in the program:</p>
  
  <pre><code>for line in open("filename.txt", "r"):
    eval(line)
  </code></pre>
  
  <p>However, when I try the code it gives me this error:</p>
  
  <pre><code>Traceback (most recent call last):
  File "D:\project-sae\Sae.py", line 25, in &lt;module&gt;
  eval(line)
  File "&lt;string&gt;", line 1
  colordefondo = "#abcdef"
               ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>My question is Why? And if anyone knows a better way to load and store the value of several options from a txt file it would be great. Nevertheless my question is about why that <code>eval</code> is failing, my knowledge about how <code>eval</code> works seems wrong and I don't know why, used it several times before, just never from a file.</p>