def dedupe(items, key=None): seen = set() for item in items: val = item if key is None else key(item) if val not in seen: yield item seen.add(val) def deleteRepeat(lst): ''' 列表去重 :param lst: :return: ''' if not lst: return lst try: l = list(dedupe(ls…