[Tutor] List sorting issues

Eric Stevens element.effect at gmail.com
Mon Mar 28 18:53:44 CEST 2011

I am currently designing an address book program, and am trying to design a
method for organizing the keys (which are the names of the entries) for
displaying purposes. I have created a list by doing sortedKeys =
self.addbook.keys() {the self.addbook refers to a dictionary in a custom
class}, and then i try to do a sortedKeys.sort() but never get an
alphabetical list of the keys. All i get is 'None'. I know that a
'list.sort()' returns a None value but all of the tutorials I see show this
giving an alphabetized list.

 I have also tried doing a 'sorted(self.addbook)' which gives me a list but
not alphabetized. The dictionary keys I am using are 'Eric', 'Kyle', and
'dfd' and they always appear in that order when i use the sorted() feature
(obviously not alphabetized).

 Could you please let me know what I am doing wrong or let me know of
another way to alphabetize an iterable object. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110328/099e03ad/attachment.html>

More information about the Tutor mailing list