I created a dictionary in the following format with keys and a list of attributes associated with each key:
inputDatasets = {
"data1": ["Path to data 1", "Attribute1", "Attribute2", "Attribute3"],
"data2": ["Path to data 2", "Attribute1", "Attribute2", "Attribute3"],
}
I would like to get a list of all the "Attribute2" contained in the dictionary. For now I use:
attr2 = []
for a, b in inputDatasets.items():
attr2.append(b[2])
But is there a more elegant way to do that?