I am trying to read contents from file which has the following content
XXX f,d,c,e
DDD f,d,c,g
ZZZ f,d,h,g
KKK c,c,d,d
I have to read this as a dictionary in the below format. The below should be my final output -
{'XXX': ['f','d','c','e'], 'DDD': ['f','d','c','g'], 'ZZZ': ['f','d','h','g'], 'KKK': ['c','c','d','d']}
But I managed to read it as dictionary in the below format. But the values are not in list format. Current output
{'XXX': 'f,d,c,e', 'DDD': 'f,d,c,g', 'ZZZ': 'f,d,h,g', 'KKK': 'c,c,d,d'}
Can someone help to convert the values as list or directly read it as list from file?