compare multiple lists in python
<p>if I have n number of lists like below</p>
<pre><code>list1 = ['one', 'three', 'four', 'six', 'seven', 'nine', 'zero']
list2 = ['two', 'four', 'five', 'six', 'eight', 'ten']
list3 = ['one', 'two', 'zero', 'three', 'seven']
list4 = ['four', 'five', 'six', 'eight', 'ten']
list5 = ['zero', 'one', 'three', 'four', 'seven', 'ten']
list6 = ['one', 'two']
</code></pre>
<p>and all elements are composed from some fixed items like below</p>
<pre><code>list_main = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']
</code></pre>
<p>the question is: I need to categorize lists according to occurrences so the result will be like this</p>
<pre><code>list2, list4 -- because they all have same 5 items ('four', 'five', 'ten', 'six', 'eight')

list1, list3, list5 -- because they all have same 4 items ('zero', 'one', 'three', 'seven')
</code></pre>
<p><strong>EDIT</strong>: like the example mentioned above</p>
<p>i want to put together the most matching lists and exclude them from the next loop</p>
<p>as when i run the process again it will look in the remaining lists and find the most matching lists and exclude them from the next loop and so on till there are no remaining lists.</p>