Hi,
I am having trouble picking the best data structure for solving a problem.
The problem is as below:
I have a nested list of identity codes where the sublists are of varying length.
li = [['abc', 'ghi', 'lmn'], ['kop'], ['hgi', 'ghy']]
I have a file with two entries on each line; an identity code and a number.
abc 2.93 ghi 3.87 lmn 5.96
Each sublist represents a cluster. I wish to select the i.d. from each sublist with the highest number associated with it, append that i.d. to a new list and ultimately write it to a new file.
What data structure should the file with numbers be read in as?
Also, how would you iterate over said data structure to return the i.d. with the highest number that matches the i.d. within a sublist?
Thanks, S :-)