Closed Sh1Fu closed 2 years ago
def find_count(self, id: str, cat: dict) -> tuple: category_ids = list() index = 0 tmp_index = 0 while (cat['catalogResponse']['data']["category"][index]["id"] != id): index += 1 current_dict = cat['catalogResponse']['data']["category"][index] category_ids.append(current_dict["id"]) while (current_dict["parentId"] != "0" and int(current_dict["id"]) >= 30): tmp_index = 0 try: while current_dict["parentId"] != cat['catalogResponse']['data']["category"][tmp_index]["id"] and tmp_index < len(cat['catalogResponse']['data']["category"]): tmp_index += 1 except BaseException: # print(tmp_index, index, current_dict, cat['catalogResponse']['data']["category"][tmp_index]) break index = tmp_index current_dict = cat['catalogResponse']['data']["category"][index] category_ids.append(current_dict["id"])
Problem with IndexError and Zero Count issue #5
FIx the idea of working with static catalog.json
catalog.json
Problem with IndexError and Zero Count issue #5
FIx the idea of working with static
catalog.json