import openpyxl import brake import current try: wb_conf = openpyxl.load_workbook('./configs.xlsx', read_only=True) ws_conf = wb_conf['attention'] except Exception as Err: msg = "无法在当前路径下找到或打开【configs.xlsx】文件,请确认!" brake.warn_pause_exit(msg, 1, 2) func_name = ws_conf['B2'].value if func_name not in wb_conf.sheetnames[1:]: msg = f"主功能选择错误,程序没有{func_name}的功能,请确认后重新输入...." wb_conf.close() brake.warn_pause_exit(msg, 1, 1) else: func_dict = {'brake': brake.main, 'current': current.main, } func_dict[func_name]()