————————

  ————data #保存class类及类中的对象

  ————int #执行程序

————————————

#@Time:2020/2/4 16:48
#@Author :jok
#@file :data.py
#@software:PyCharm
class web:
    def home(self):
        return "首页"
    def list(self):
        return "列表"
    def a_404(self):
        return "404"
    def page(self):
        return "page"
data.py
#@Time:2020/2/4 16:48
#@Author :jok
#@file :int.py
#@software:PyCharm
import data
while True:
    int = input("请输入要访问的页面")
    web = getattr(data,"web")
    if hasattr(web,int):
        func = getattr(web(),int)
        print(func())
    else:
        print(getattr(web(),"a_404")())
int.py

效果截图