On Sun, 26 Aug 2007, Eric Abrahamsen wrote:
> I wrote the stupid little script below for practice; it takes a text
> file with a list of surnames, and returns a dictionary where the keys
> are first letters of the names, and the values are lists of names
> grouped under their appropriate fir
Whoa, this made my brain hurt. And I thought I was being clever using
a set...
I can't say I really understand this yet, but I'm trying. If anyone's
following along at home I found this link kind of helpful:
http://python.net/crew/mwh/hacks/setdefault.html
Thanks a lot for your help,
Eric
Eric Abrahamsen wrote:
> I wrote the stupid little script below for practice; it takes a text
> file with a list of surnames, and returns a dictionary where the keys
> are first letters of the names, and the values are lists of names
> grouped under their appropriate first-letter key, like so:
>
>
> From noob to noob : sort sorts in place. I seem to remember it
> returns nothing.
>
> This works:
>
> In [12]: directoryOut[12]:
> {'A': ['Abercrombie', 'Aalberg'],
> 'B': ['Barnaby', 'Black', 'Biggles'],
> 'D': ['Douglas', 'Dawn', 'Diggle'],
> 'G': ['Granger', 'Gossen']}
>
> In [13]: for key i
I wrote the stupid little script below for practice; it takes a text
file with a list of surnames, and returns a dictionary where the keys
are first letters of the names, and the values are lists of names
grouped under their appropriate first-letter key, like so:
{'A': ['Abercrombie'], 'B':