:param the_list: [1, 2, 3, 4, 5, 6, 1, 2, 4, 5] :param to_match: [1, 2] :return: [(0, 1), (6, 7)]
(the_list, to_match)
| 78 | return gold_list |
| 79 | |
| 80 | def match_sublist(the_list, to_match): |
| 81 | """ |
| 82 | :param the_list: [1, 2, 3, 4, 5, 6, 1, 2, 4, 5] |
| 83 | :param to_match: [1, 2] |
| 84 | :return: |
| 85 | [(0, 1), (6, 7)] |
| 86 | """ |
| 87 | len_to_match = len(to_match) |
| 88 | matched_list = list() |
| 89 | for index in range(len(the_list) - len_to_match + 1): |
| 90 | if to_match == the_list[index:index + len_to_match]: |
| 91 | matched_list += [(index, index + len_to_match - 1)] |
| 92 | return matched_list |
| 93 | |
| 94 | def record_to_offset(instance): |
| 95 | """ |