If I have the following list to start:
list1 = [(12, "AB"), (12, "AB"), (12, "CD"), (13, Null), (13, "DE"), (13, "DE")]
I want to turn it into the following list:
list2 = [(12, "AB", "CD"), (13, "DE", Null)]
Basically, if there is one or more text values with their associated keys, the second list has the key value first, then one the text value, then the other. If there is no second string value, then the third value in the item if the second list is Null.
I've gone over and over this in my head and cannot figure out how to do it. Using set() will cut down on exact duplicates, but there is going to have to be some sort of previous/next operation to compare the second values if the key values are the same.
The reason I am not using a dictionary is that the order of the key values has to stay the same (12, 13, etc.).