I have a yaml that I need to process with a python script, the yaml is something like this:
user: john
description: Blablabla
version: 1
data:
data1: {type : bool, default: 0, flag: True}
data2: {type : bool, default: 0, flag: True}
data3: {type : float, default: 0, flag: false}
I need a list the the names of all the data that for example are bools or float, or all the ones where "flag" equals True or False, but I'm having difficulties moving around the list and getting what I need.
I've tried something like this:
x = raw_data.items()
for i in range(len(x['data'])):
if (x['data'][i]).get('type') == "bool":
print(x['data'][i])
But then I get an error: TypeError: 'dict_items' object is not subscriptable