This sort of thing can be done with ndarray.tofile.