Let's say I have a dict like this:
my_dict = {something: 'blabla', result: 'something', value_0_0: 'apple', value_0_1: 'ball', value_1_0: 'banana', value_1_1: 'car', value_2_0: 'orange', value_2_1: 'toy'}
The dict may have other key-value entries with other names like: result: 'something'. I just want to filter those keys with the following structure:
value_X_Y
Desired output:
0values = "apple ; banana ; orange"
1values = "ball ; car; toy"
If the size of the dictionary was fixed, you could do something like this:
for x in my_dict:
if(x == 'value_0_0'):
#do something
if(x == 'value_0_1'):
#do something
if(x == 'value_1_0'):
#do something
if(x == 'value_1_1'):
#do something
if(x == 'value_2_0'):
#do something
if(x == 'value_2_1'):
#do something
But since the dictionary do not have a fixed size and can have 3 values or 50 (for example) value_50_0, value_50_1, I would like to process the data dynamically.
How could I get something like that?
Any insights will be appreciated.