From a loop I\'m getting an array. I want to save this arrays in a tempfile. The problem is that np.savez only saves the last array from the loop.
tempfile
np.savez
It is also possible to use custom keys by using ** operator.
**
import numpy as np a1 = [1,2,3] a2 = [10,20,30] savez_dict = dict() for i in ['a1', 'a2']: savez_dict['key_'+i] = i np.savez("t.npz", **savez_dict)