Solve Problems by Coding Solutions - A Complete solution for python programming
sample_tuple = ((4, 'Gfg', 10), (3, 'is', 8), (6, 'Best', 10))
print("The original tuple : " + str(sample_tuple))
res = [{'key': sub[0], 'value': sub[1], 'id': sub[2]} for sub in sample_tuple]
print("The converted dictionary : " + str(res))
Post a Comment
No comments:
Post a Comment