Setting properties from CSV file using eval (Python)
<p>I have CSV files that contain numerous values that I want to reference. I wanted to parse them succinctly using <code>eval</code>. Here's what I tried:</p>

<pre><code>line = fileHandle.readline()
while line != "":
  if line != "\n":
    parameter = line.split(',')[0]
    value = line.split(',')[2].replace("\n", "")
    eval("%s = \"%s\"" % (parameter, value))
    print(parameter + " = " + eval(parameter)) # a quick test
  line = fileHandle.readline()
</code></pre>

<p>What I get is:</p>

<pre><code>Traceback (innermost last):
  File "&lt;string&gt;", line 73, in ?
  File "&lt;string&gt;", line 70, in createJMSProviders
  File "&lt;string&gt;", line 49, in createJMSProviderFromFile
  File "&lt;string&gt;", line 1
    externalProviderURL="tibjmsnaming://..."
                       ^
SyntaxError: invalid syntax
</code></pre>

<p>I reads to me like it is not possible to <code>eval("externalProviderURL=\"tibjmsnaming://...\"")</code>. What is wrong with this statement?</p>
