There is CGIHandler that ships with python. Not many examples that are simple, so...
#!/usr/bin/env python
from wsgiref.handlers import CGIHandler
def app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return [
b"<html><head><title>foo</title></head><body>bar</body></html>"
]
if __name__ == '__main__':
CGIHandler().run(app)