import openpyxl def compare_conference_city_in_order( actual_city_list_path, expected_city): expected_city_list = expected_city["expected"] print(f"Reading csv file from {actual_city_list_path}") wb = openpyxl.load_workbook(actual_city_list_path) sheet = wb.active actual_city_list = [] for row in sheet["C2:C22"]: for cell in row: actual_city_list.append(cell.value) # expected_city is the city that we want to compare with the actual city list # must in order index # debug print("expected_city_list:") print(expected_city_list) print("actual_city_list_path:") print(actual_city_list) wrong_list = [] try: for i in range(len(actual_city_list)): if expected_city_list[i] not in actual_city_list[i]: wrong_list.append(i) print(f"Expected city {expected_city_list[i]}; Actual city {actual_city_list[i]}") except: return False return True if len(wrong_list) == 0 else False