I have a dictionary which looks something like this:
dicts =
{"A" : ['shape_one.csv','shape_two.csv','volume_one.csv','volume_two.csv'],
"B" : ['shape_one.csv','shape_two.csv','volume_one.csv','volume_two.csv']}
All the values inside the list of values are paths of a .csv file which I extracted using os.walk(). Now I want to just extract the values which have the string "volume_" in them, and store these values in a list. I want to do this for each key in the dictionary.
I am using python 3.8. I would appreciate any help, as I am a non-programmer just trying to finish a task programmatically. thank you in advance.
The output should return seperate lists for each key, even if the values share the same name.
volume_list_A = ['volume_one.csv','volume_two.csv']
volume_list_B = ['volume_one.csv','volume_two.csv']
I have tried doing:
volume_list = [x for x in list(dicts.values()) if "volume_" in x]
but this just returns an empty list.