I have a nested dictionary structure with tuple keys. Here's what an entry looks like when I pretty-print the dictionary using pprint:
...
('A', 'B'): {'C': 0.14285714285714285,
'D': 0.14285714285714285,
'E': 0.14285714285714285,
'F': 0.14285714285714285,
'G': 0.14285714285714285,
'H': 0.14285714285714285,
'I': 0.14285714285714285},
...
It's pretty nifty, but I'd like to customize it further by cutting down some extra digits from the floats. I was thinking that it'd be possible to achieve by subclassing pprint.PrettyPrint
but I don't know how that would be done.
Thanks.
super(FormatPrinter, self)
instead ofpprint.PrettyPrinter
? – Palmira