-1

I want to print my array without brackets and without changing the order/format, so for example:

Array with brackets

I just want to remove the brackets from print(a). How can I do that?

This question is not a duplicate of others questions on that site since those solutions dont keep the format.

TWstud
  • 81
  • 6
  • Does this answer your question? [How to print a Numpy array without brackets?](https://stackoverflow.com/questions/9360103/how-to-print-a-numpy-array-without-brackets) – Georgy Jan 13 '20 at 08:17
  • Do not post images of code – *even* if it's such trivial code as you show here. It is more trouble to type it in than to select and copy. Therefore, you are making it harder to help you. – Jongware Mar 08 '20 at 11:31

1 Answers1

0

You can capture the print output, remove the brackets, then print it out again

import numpy as np
import io
x=np.array([[7,8,5],[3,5,7]],np.int32)
b = io.StringIO()
print(x, file=b)
s = b.getvalue()
s = s.replace('[', ' ').replace(']', ' ')
print(s)