python3-numpy: Appending to a file using numpy savetxt
You should open file by binary mode.
#!/usr/bin/env python3import numpy as np f=open('asd.dat','ab')for iind in range(4): a=np.random.rand(10,10) np.savetxt(f,a)f.close()
reference:python - How to write a numpy array to a csv file? - Stack Overflow How to write a numpy array to a csv file?