I want to write a 2D numpy array into a human-readable text file format. I came across this question asked before but it only specifies equal number of space to be associated with each element in the array. In it all elements are spaced out with 10 spaces. What I want is different number of space for each column in my array.
Writing white-space delimited text to be human readable in Python
For example, I want 7 spaces for my 1st column, 10 spaces for my 2nd column, 4 spaces for my 3rd column, etc. Is there an analogy to numpy.savetxt(filename, X, delimiter = ',', fmt = '%-10s'), but where instead of '%-10s' I have say '%-7s, %-10s, %-4s' etc?
Thank you