consider i'm getting out from a row where row[0],row[1],row[2] consists of below output and it comes in same order as below:
'Testcase2', 37L, 'hydra.c
'Testcase2', 100L,'vendor.c
'Testcase7', 34L, 'template.c
'Testcase3', 88L, 'hydra.c
'Testcase3', 80L, 'vendor.c
'Testcase6', 81L, 'template.c
'Testcase1', 1L, 'hydra.c
'Testcase4', 89L, 'vendor.c
'Testcase8', 41L, 'template.c
'Testcase5', 83L, 'vendor.c
'Testcase4', 98L, 'template.c
i need a unique test case names to be printed along with maximum row[1] value so i thought of creating dictionary with multiple values.
{'Testcase1': {'hydra.c': 1},
'Testcase2':{'hydra.c':37,'vendor.c':100 },
'Testcase3':{'hydra.c':1,'vendor.c':80}
'Testcase4':{'vendor.c':89,'template.c':98},
'Testcase5':{'vendor.c':83}
'Testcase6':{'template.c':34}....}
for creating dictionary with multiple values as above please do help me so that later i will do sorting of nested dict so that later i ll print testcase name with highest row[1] value:
from pprint import pprint as pp
d={}
for x,y,z in row:
d.setdefault(x,{z:[]})
d[x][z].append(y)
pp(d)
i tried above code but its updating only with new file name its not appending as above requirement.