Python Dictionary values, multiple dictionaries

How can I get the value of “project name” from each dictionary without the keys and values of all of the other dictionary keys and values i.e the value for “project name” only?

Cust1 = {‘project_name’: ‘ABC_Company’, ‘resources’: [‘m2xlarge’, ‘c4micro’], ‘cost’: 4500.00}

Cust2 = {‘project_name’: ‘DEF_Company’, ‘resources’: [‘m4xlarge’, ‘c4micro’], ‘cost’: 2500.00}

Cust3 = {‘project_name’: ‘GHI_Company’, ‘resources’: [‘c4micro’], ‘cost’: 500.00}



we could also insert the dictionaries in a list, and then loop over the list.

thank you for that answer - also, how to collect those together rather than as three separate things? for instance, I want to get all those values and print them together.

let me phrase that better, we could create a list and store the dictionaries in it. This would mean having the dictionaries in a single place, and allow for looping

then loop over the list, inside the loop create a new list

.append() the values of the dictionary to the new list

then after the loop, use .join() to print all the values.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.