'How to store np.ndarray to file?

I have a ndarray with the shape (15,11,5). How to save the array to 5 files that includes 11 columns and 15 rows?

import numpy as np

a = np.ndarray(shape=(15,11,5), dtype=float, order='F')

for i in range(5):
    with open('file{i}.txt', 'wb') as f:
        np.savetxt(f, np.column_stack(a[:,:,i]), fmt='%1.10f')


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source