I have a huge dictionary with over a 1000 keys and each value is over 600 000 int long. Now, I need to extract some of these integers, so from 600 000 I want to go to let's say 5k. But it can't be random 5k, they have to be at very specific positions. Due to the fact that 5k is still a little too big to extract it by hand, I need to use a list of indices that will indicate which integers in the value should be taken out. I have tested extraction on small lists, with indices [1,3,5,7,9] and long_val ['a','b','c','d','e','f','g','h','i','j','k'] then I can do that:
for each in xrange(len(long_val)):
print indices[long_val[each]]
and I get b,d,f,h and j (as required).
Now, it's not as simple when it comes to dealing with dictionaries (where long_val) is replaced by actual dictionary value). I have tried that:
for keys,values in dict_gtps.iteritems():
for each in xrange(len(values)):
abs_new[keys]=pos_3[values[each]]
But I'm getting "Index out of range" error message.