How to display python code on a html page: Beginner -


i absolute beginner in coding python , wondering whether lead me in right direction. have written code can access database terminal...that's fine. want display results in html page.....which have designed. how possible connect code in terminal display output on html page. told must use framework such flask?

this may seem extremely easy dont understand how works...any advice great...thanks!

your life easier if used framework of kind. knowledge used python web framework django: https://www.djangoproject.com/

however possible use python in number of ways display webpage content.

you can use python cgi (http://docs.python.org/2/library/cgi.html)

here hello world example:

#!/usr/bin/env python # -*- coding: utf-8 -*-  import cgitb cgitb.enable()  html = "hello world!"  print "content-type: text/html;charset=utf-8" print print html.encode("utf-8") 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

visual studio - TFS will not accept changes I've made to a Java project -