I have a list of list
List = [['ServerA','Envname1','abc','xyz'],
['ServerA','Envname2','abc','xyz'],
['ServerB','Envname3','aaa','bbb'],
['ServerC','EnvName4','uuu','vvv'],
['ServerB','Envname5','aaa','bbb']]
If the server is same then the values at 2nd and 3rd index of the inner lists will be same.
For example:- In the 1st list ['ServerA','Envname1','abc','xyz'] and 2nd list ['ServerA','Envname2','abc','xyz'] server is same ('ServerA') so the values 'abc' and 'xyz' is same.
Likewise, values for ServerB in the 3rd and 4th is same 'aaa' and 'bbb'
Only the Envname is changing even if the server is same.
What i want in my final list of list is to group all the servers which has the same name and add all the Envnames in them accordingly, rest of the elements will be the same if the server name is same.
Expected List
Final_list = [['ServerA','Envname1,Envname2','abc','xyz'],
['ServerB','Envname3,Envname5','aaa','bbb'],
['ServerC','EnvName4','uuu','vvv']]
Can anybody advise me on this?