Answer the question
In order to leave comments, you need to log in
How does async work in Tornado?
There is this code:
import tornado.web
from tornado.ioloop import IOLoop
from tornado import gen
class MainHandler(tornado.web.RequestHandler):
async def get(self):
for i in range(5):
if i == 4:
print(i)
await gen.sleep(1)
print("Lol")
application = tornado.web.Application([
(r"/test", MainHandler),
])
if __name__ == "__main__":
application.listen(9999)
IOLoop.instance().start()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question