title: Python EOL error in Exec function which evaluates to include a string containing a quote
body: <p>I am composing a string to execute to assign a value to an arbitrarily deep point in a json file, the values I'm assigning are strings and some of these strings contain quotes, this is where I get errors.</p>
  <p>I've tried replacing the &quot; in the strings I am assigning with &quot;, encasing the string I'm assigning in triple quotes and both together.</p>
  <p>Also everything below didn't start in triple quotes this is just a latest attempt to solve this.</p>
  <p><strong>Code</strong></p>
  <pre><code>for index, row in md_csv.iterrows():
      json_ref_string = ''
      for k in row['Path']:
          json_ref_string += &quot;['&quot;
          json_ref_string += k
          json_ref_string +=&quot;']&quot;
      my_string =&quot;&quot;&quot;jo&quot;&quot;&quot;+json_ref_string+&quot;&quot;&quot;=&quot;&quot;&quot;+&quot;&quot;&quot;\&quot;&quot;&quot;&quot;+str(translated_csv.iloc[index][1])+&quot;&quot;&quot;\&quot;&quot;&quot;&quot;
      exec(my_string)
  </code></pre>
  <p><strong>Error</strong></p>
  <pre><code>    File &quot;/Users/maxgreen/opt/anaconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py&quot;, line 3437, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
  
    File &quot;&lt;ipython-input-244-a1adf20fc0ec&gt;&quot;, line 9, in &lt;module&gt;
      exec(my_string)
  
    File &quot;&lt;string&gt;&quot;, line 1
      jo['agreementinfo']=&quot;Estoy celebrando este acuerdo en nombre de la parte contratante cuyos detalles he presentado en la página &quot;INFORMACIÓN COMERCIAL&quot;, en adelante, el &quot;COMERCIANTE&quot;&quot;
                                                                                                                                      ^
  SyntaxError: invalid syntax
  </code></pre>