gpt4 book ai didi

python - 在 webpy 中使用另一个类

转载 作者:行者123 更新时间:2023-12-01 05:55:10 25 4
gpt4 key购买 nike

我必须在 webpy 中导入另一个类网页.py

urls = (
'/', "Home"
)
class Web:

def __init__(self):
app = web.application(urls, globals())
app.run()

home.py

class Home:
def GET(self):
return "Hello, world!"

谁能告诉我为什么这不起作用?

最佳答案

如果两个文件位于同一文件夹中,那么您可以尝试以下操作:

urls = (
'/', "home.Home"
)

关于python - 在 webpy 中使用另一个类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12950851/

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