0

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.

xtofl
  • 40,723
  • 12
  • 105
  • 192

3 Answers3

0

Most of time this gives a readable output:

import pprint
pprint.pprint(o)
Mike Müller
  • 82,630
  • 20
  • 166
  • 161
0

Try doing ", ".join(my_long_list).

rmunn
  • 34,942
  • 10
  • 74
  • 105
  • I would love to do that, but the list is buried deep within a data structure, and I would like to have a solution that introspects the object without me having to knowing it's structure. – xtofl Jun 07 '13 at 13:44
0

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.

A snippet to show this.

xtofl
  • 40,723
  • 12
  • 105
  • 192