016-路由 传参
假设路由设置如下:
{"word1":"lll","word2":"aaa"} 表示参数
(r'/sunck',index.SunckHandler,{"word1":"lll","word2":"aaa"})
那么传参代码如下:
1 from tornado.web import RequestHandler 2 class SunckHandler(RequestHandler): 3 ''' 4 def initialize(self,c1,c2,c3,c4): 5 self.w1=c1 6 self.w2=c2 7 加上这部分代码 8 ''' 9 def initialize(self,word1,word2): 10 self.word1=word1 11 self.word2=word2 12 13 def get(self): 14 print(self.word2,self.word1)
===今日我言===========
勇气 让人进步
===================