Having trouble printing a namedtuple
:
Info = namedtuple('Info', ['type', 'value', 'x', 'y'])
so that the values are aligned and with space(padding) between them, for example like so:
Info( type='AAA', value=80000, x=16.4, y=164.2 )
Info( type='A', value=78, x=1.5, y=11.3 )
Info( type='ABBCD', value=554, x=11.7, y=10.1 )
Info( type='AFFG', value=1263, x=121.3, y=12.8 )
Ideally, without the commas.
I have tried pprint
and tried printing using the _asdict
with no success as suggested here. Same with the format
which I could not make it to behave with named tuples.
Any ideas or example codes?