Hi, I am not using Python but I have script in python:

part of script

`elif line.find("CONECT") > -1:
                con = line.split()
                line_value = line_value + 1
                #print line_value
                #print con[2]
                        line_j = "e" + ', ' + str(line_value) + ', ' + con[2] + "\n"
                        line_i = "e" + ', ' + str(line_value) + ', ' + con[3] + "\n"
                        line_k = "e"+ ', ' + str(line_value) + ', ' + con[4] + "\n"
                except IndexError:

which give .txt output in format

e, 1, 2

e, 1, 3

e, 1, 4

e, 2, 1

e, 2, 3


I need remove similar lines with the same numbers, but no matter on order this numbers

i.e. line e, 2, 1..

Is it possible? Please help me

Yes, you must just make the number split from file line numeric and check if that line had line_value in it if it is lower than current line_value, as you seem to have line_value always increasing and the lines with second value higher do not need checked. You might add all numbers from the line in set for this check, maybe list of sets.

You have very similar lines in your code, it would better to use loop over the list from third value to end (con[2:]).

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