寫好代碼,運作。
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIyZuBnLwQTO1MjNyATMxEjMxAjMwIzLc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
# coding: utf8
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!")
class meHandler(tornado.web.RequestHandler):
def get(self):
self.write("me, change the tornado")
application = tornado.web.Application([
(r"/", MainHandler),
(r"/test", TestHandler),
(r"/me", meHandler)
])
if __name__ == "__main__":
application.listen(8888)
tornado.ioloop.IOLoop.instance().start()
# 127.0.0.1:8888
本地網址:
127.0.0.1:8888/test
127.0.0.1:8888