I have a dictionary:
dic={\'Tim\':3, \'Kate\':2}
I would like to output it as:
Name Age
Tim 3
Kate 2
Is i
You can do it this way,
format = "{:<10}{:<10}"
print format.format("Name","Age")
for name,age in dic.iteritems():
print format.format(name,age)
I have written a simple library to pretty print dictionary as a table https://github.com/varadchoudhari/Neat-Dictionary which uses a similar implementation