Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在python中,两个路由字符串相互追加_Python_Google App Engine - Fatal编程技术网

在python中,两个路由字符串相互追加

在python中,两个路由字符串相互追加,python,google-app-engine,Python,Google App Engine,在下面的代码中location\u id=“Roger”和court\u id=“court1” 其中get定义如下 class Schedule(BaseHandler): def get(self, location_id, court_id): self.render_template('schedule.html', {'location':location_id,'court':court_id}) 但是当我使用以下路由到达schedule.html模板时 a

在下面的代码中
location\u id=“Roger”
court\u id=“court1”

其中get定义如下

class Schedule(BaseHandler):
    def get(self, location_id, court_id):
        self.render_template('schedule.html', {'location':location_id,'court':court_id})
但是当我使用以下路由到达schedule.html模板时

app = webapp2.WSGIApplication([
        ('/', MainPage), 
        ('/create/([\w]+)', CreateCourt), 
        ('/createlocation/([\w]+)', CreateLocation), 
        ('/schedule/([\w]+/([\w]+))', Schedule) 
        ],
        debug=True)
位置
的价值已经增长到包括一个
/
法庭
的价值:“罗杰/法庭1”

如何将“场地/场地”的两个部分分开?
我怀疑答案与/schedule的路由regexp有关。

我认为你是对的-在你的
schedule
处理程序中,看起来你缺少了右括号(以前从未键入过单数-奇怪:)。试试这个:

app = webapp2.WSGIApplication([
        ('/', MainPage), 
        ('/create/([\w]+)', CreateCourt), 
        ('/createlocation/([\w]+)', CreateLocation), 
        ('/schedule/([\w]+)/([\w]+)', Schedule) 
        ],
        debug=True)

我认为你是对的-在你的
日程安排
处理程序中,看起来你缺少了右括号(以前从未键入过单数-奇怪:)。试试这个:

app = webapp2.WSGIApplication([
        ('/', MainPage), 
        ('/create/([\w]+)', CreateCourt), 
        ('/createlocation/([\w]+)', CreateLocation), 
        ('/schedule/([\w]+)/([\w]+)', Schedule) 
        ],
        debug=True)

是的,这就是问题所在。即使你用一个额外的“')来纠正错误。但重要的部分你做对了<代码>('/schedule/([\w]+)/([\w]+),schedule)谢谢。哈哈,更正了(regex总是让我头晕目眩)。很高兴它能起作用。是的,这就是问题所在。即使你用一个额外的“')来纠正错误。但重要的部分你做对了<代码>('/schedule/([\w]+)/([\w]+),schedule)谢谢。哈哈,更正了(regex总是让我头晕目眩)。很高兴它起作用了。