for key, value in test_session_results[test_env].iteritems():
my_dict = {"test_case": key, "status": value}
new_dict.update(my_dict)
I have this piece of code and what I want to do is to create a list of dictionaries, because my_dict has always the different value. What should I do?
CodePudding user response:
You can create an empty list and append the dictionaries to that list.
a = []
for key, value in test_session_results[test_env].iteritems():
my_dict = {"test_case": key, "status": value}
a.append(my_dict)