I am trying to match up items in a list if the items contain the same strings as other items in the list.
So I have a list and I am only checking the items in the list if the have a '.' in them currently.
for g in groups:
if '.' in g:
print(g)
663.ord1,664.ord1
947.dfw3,949.dfw3
663.ord1
665.ord1,664.ord1
663.ord1,665.ord1
949.dfw3,948.dfw3
949.dfw3
947.dfw3,948.dfw3
What I want to do is print a 2 item list if the first part of the item matches another first part of the item (so separated on '.'
So for the input listed above. I am looking for the following, not necessarily in this order:
['663.ord1,664.ord1', '663.ord1']
['947.dfw3,949.dfw3','949.dfw3,948.dfw3']
['947.dfw3,949.dfw3','949.dfw3']
['947.dfw3,949.dfw3','947.dfw3,948.dfw3']
['665.ord1,664.ord1','663.ord1,665.ord1']
['663.ord1,665.ord1','663.ord1']
['949.dfw3,948.dfw3','947.dfw3,948.dfw3']
...I think I got them all...
Anyone have an idea how this could be done?