Write Python3 code to demonstrate working of Segregating key's value in list of dictionaries Using zip() + map() + values()


Topic: Write Python3 code to demonstrate working of Segregating key's value in list of dictionaries Using zip() + map() + values()

Solution

test_list = [{'gfg' : 1, 'best' : 2}, {'gfg' : 4, 'best': 5}] 
print("The original list : " + str(test_list)) 
res = list(zip(*map(dict.values, test_list))) 
 
print("Segregated values of keys are : " + str(res)) 



List all Python Programs