title: Python PHP equivalent
body: <p>I have been using <code>PHP</code> for a while now with my <code>Apache2</code> web server on my raspberry pi.  It works great, but I get tired of always having to think &quot;how do I X in PHP&quot; or &quot;what was the function name for this in PHP&quot;.</p>
  <p>I am under the strong impression that there should be something equivalent in which I can replace the <code>&lt;?php ?&gt;</code> code with <code>python</code> code, but my search results have been confusing at best.</p>
  <p>I am essentially looking for something where I can write whatever <code>python</code> code I want in an HTML script and have it interpreted and executed and its output inserted into the page when it is requested.</p>
  <p>For example, to make a table of users from a list in <code>python</code>.</p>
  <pre><code>&lt;table&gt;&lt;tr&gt;&lt;td&gt;User list&lt;/td&gt;&lt;/tr&gt;
  &lt;?python
      import json
      library=json.load(open(some_json_file,'r')); 
      for user in library:
          print &quot;&lt;tr&gt;&lt;td&gt;&quot;+user+&quot;&lt;/td&gt;&lt;/tr&gt;&quot;
  ?&gt;
  &lt;/table&gt;
  </code></pre>
  <p>I'm under the impression that chameleon can do this with its code blocks as described here,(<a href="https://chameleon.readthedocs.io/en/latest/reference.html" rel="nofollow noreferrer">https://chameleon.readthedocs.io/en/latest/reference.html</a>) but as I look deeper, I get the impression it doesn't work like I am thinking it should.   This is the impression I have gotten from all of the template engines I have looked at, as well as WSGI</p>
  <p>Are there good drop in python alternatives for PHP?  Or are there ways to cleanly wrap semi complex python code into my php in way that doesn't involve writing an additional python script that is called by PHP?  I've tried <code>exec()</code> with <code>python -c</code>; but this was less than ideal having to escape all the ' and &quot; characters...</p>