Hi, I have text file where I have these lines with numbers:

e, 1, 2

e, 1, 3

e, 2, 1

e, 3, 4

etc.

I need remove similar lines, in this case line e, 2, 1. Is it possible?

Featured Replies

- 1
Please post the code you have tried so far, to be used as a starting point. The question can not be answered until we know how "e, 2, 1" is similar Read More

- 1
@David W This is also a universal problem with a known solution >>> lst = [ ['e', 1, 2], ['e', 2, 1], ['e', 1, 2], ['e', 2, 3] ] >>> lst2 = list(unique_everseen(lst, key=lambda x: tuple(sorted(x[1:3])))) >>> lst2 [['e', 1, 2], ['e', 2, 3]] unique_everseen is in the itertools module's … Read More

This topic has been dead for over six months. Start a new discussion instead.

Recommended Topics