base_path = os.getcwd() sys.path.append(base_path) open_excel = openpyxl.load_workbook(base_path+"/Case/imooc.xlsx")
base_path打印是/Users/wy/PycharmProjects/ApiAuto/Util
那么:open_excel=/Users/wy/PycharmProjects/ApiAuto/Util/Case/imooc.xlsx
但imooc.xlsx的实际路径是/Users/wy/PycharmProjects/ApiAuto/Case/imooc.xlsx
所以这么openpyxl.load_workbook(base_path+"/Case/imooc.xlsx")拼接就不对