on-internet
← Community

Can I make array2string output without brackets and indentation?

Stack Overflow ·

I need to print/write using a fixed format (6 fields at 13.7e). The array I need to print might have 4, 8, 12, or more values. I found np.array2string, which is almost what I need. Is there a way to eliminate the leading and trailing [ and ]? Likewise, is there a way to avoid the indentation on 2nd and following lines? A solution does not have to use array2string, it was just the simplest thing I found to control print/write formatting for ndarray. I am open to any solution. :-) Here is a simple example to demonstrate the behavior I want, and what I get: >>> import numpy as np >>> foo = np.ara

Comments

Sign in or sign up to comment and upvote.

No comments yet.