I'm reading data from a binary file that contains a dictionary as follows:
a_dict =
{'8a50b9f75b57104d89b58305d96045df':[b'\x94*\x08\x9d\xd8', 0, 1, 4, 6, 7],
'bff92f621cc65e2103305343a943c9a8':[b'\x85*\xe4\xf0\xd7', 2, 3, 5, 8, 9]}
Where the binary code are the file contents itself, and the remaining list items are the indexes. So for this specific case, the output should look like this(without the double spaces):
(1st hash) (1st hash) (2nd hash) (2nd hash)
\x94*\x08\x9d\xd8 \x94*\x08\x9d\xd8 \x85*\xe4\xf0\xd7 \x85*\xe4\xf0\xd7 ...
I'm having a bit of trouble to accomplish this, and other examples on this site are not quite what I'm looking for (I'm sure they are out there, but maybe I'm searching for the wrong keywords).
My code is the following:
with open(fname, 'rb') as f:
a_dict = pickle.load(f)
for value in a_dict.values():
print(value[1:])
and this gives me the two lists [0, 1, 4]
and [2, 3, 5]
that I need to reconstruct the file. I need a way to iterate through those lists (in order 0, 1, 2, 3, ...) and concatenate the corresponding bytes.