Found out that the object I was trying to display had a repr that explicitly showed it's array content in a vertical manner... So this question may be closed.
On regular python lists, arrays are printed on one line.
题
I have an object with a huge list somewhere down in the bowels. The object's dump (e.g. using print(o)
) doesn't fit on one screen.
But if I could manage to have members that are 1-D lists printed comma-separated on one line, the object would be easier to inspect.
How can this be achieved?
EDIT:
Found out that the object I was trying to display had a __repr__
that explicitly showed it's array content in a vertical manner... So this question may be closed.
解决方案 3
Found out that the object I was trying to display had a repr that explicitly showed it's array content in a vertical manner... So this question may be closed.
On regular python lists, arrays are printed on one line.
其他提示
Most of time this gives a readable output:
import pprint
pprint.pprint(o)
Try doing ", ".join(my_long_list)
.