Re: groupby and itemgetter

2006-10-06 Thread Steven Bethard
Roman Bertle wrote: > Hello, > > there is an example how to use groupby in the itertools documentation > (http://docs.python.org/lib/itertools-example.html): > > # Show a dictionary sorted and grouped by value from operator import itemgetter d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) >

groupby and itemgetter

2006-10-06 Thread Roman Bertle
Hello, there is an example how to use groupby in the itertools documentation (http://docs.python.org/lib/itertools-example.html): # Show a dictionary sorted and grouped by value >>> from operator import itemgetter >>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) >>> di = sorted(d.iteritems(), key=