gpt4 book ai didi

python - Webpy,从另一个方法调用 View

转载 作者:太空宇宙 更新时间:2023-11-03 17:50:10 26 4
gpt4 key购买 nike

有什么方法可以使用参数调用 webpy (GET) View (从另一个 View )?

提前致谢。

最佳答案

import web

urls = (
'/(\d+)', 'index',
'/number', 'novo'
)


class index:
def GET(self, number):
return "Number: %i " % number


class number:
def GET(self):
get_index = index()
return get_index.GET(3)


app = web.application(urls, globals())
if __name__ == "__main__":
app.run()

关于python - Webpy,从另一个方法调用 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29212638/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com