标签:ret attr python pen image das import arm class
————————
————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"
#@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")())
效果截图
标签:ret attr python pen image das import arm class
原文地址:https://www.cnblogs.com/bdua/p/12260080.html