This is no longer static content. You want to dynamically generate content using a script.
In Python, this is usually done using the WSGI interface ( CGI was the de facto standard in the past ), which defines the standard way to enter Python code (HTTP request information) and send a response (HTTP headers and the content you want to serve - usually HTML )
For this purpose, there is an excellent mod_wsgiApache module that configures the plumbing between the server (receiving requests and sending back content) and your code using this WSGI interface.
- templating, HTML ( Jinja2).