2025年3月27日 星期四 甲辰(龙)年 月廿六 设为首页 加入收藏
rss
您当前的位置:首页 > 计算机 > 编程开发 > Python

python系统首页句柄方法

时间:05-20来源:作者:点击数:50

python系统首页句柄方法

  • from src.service import download, search, page
  • def run():
  • func_dict = {
  • '1': {'title': "分页看新闻", 'func': page.execute},
  • '2': {'title': "搜索专区", 'func': search.execute},
  • '3': {'title': "下载专区", 'func': download.execute},
  • }
  • tips = ";".join(["{}.{}".format(k, v['title']) for k, v in func_dict.items()])
  • while True:
  • print(tips)
  • choice = input("请输入序号(Q/q退出):")
  • if choice.upper() == 'Q':
  • break
  • data_dict = func_dict.get(choice)
  • if not data_dict:
  • print("序号不存在,请重新输入!")
  • continue
  • data_dict['func']()

 

方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门