[Tutor] Dictionaries

Kent Johnson kent37 at tds.net
Fri Jan 27 15:52:58 CET 2006


Jon Moore wrote:
> Hi
> 
> Is there anyway to print informtation from dictionaries better than this?:
>  
>  >>> pairs = {"Jon Moore": "Tony Moore",
>          "Simon Nightingale": "John Nightingale",
>          "David Willett": "Bernard Willet",
>          "John Jackson": "Stuart Jackson",
>          "James Southey": "Richard Southey",
>          "William Forsythe": "Shaun Forsythe"}
>  >>> print pairs.keys()
> ['David Willett', 'Jon Moore', 'John Jackson', 'Simon Nightingale', 
> 'James Southey', 'William Forsythe']
>  >>>

There is a very nice table formatting recipe here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/267662

Kent



More information about the Tutor mailing list