How do I interface python progam with the web
I have a python program and need to run that program in the background and get the out开发者_Go百科put in the browser .we are using a plug-in for this purpose and I found that only html and Java script can be run in chrome extension.
Are you trying to build a web application? If so, web.py is my personal favorite. It's very lightweight and easy to use.
Here's an entire web application -- albeit a trivial one.
import web
urls = (
'/(.*)', 'hello'
)
app = web.application(urls, globals())
class hello:
def GET(self, name):
if not name:
name = 'World'
return 'Hello, ' + name + '!'
if __name__ == "__main__":
app.run()
精彩评论