按照http://www.tornadoweb.cn/所提供的方法下载安装后编写如下程序:
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
class TestHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello Evilxr,This is you's Python!")
application = tornado.web.Application([
(r"/", MainHandler),
(r"/test",TestHandler),
])
if __name__ == "__main__":
application.listen(8888)
tornado.ioloop.IOLoop.instance().start()
退出VI 后运行该脚本 root@IdeaPad:~/test# python one.py


若非特别声明,文章均为Evilxr的个人笔记,转载请注明出处。
浙公网安备 33010602011771号