JoJo <[EMAIL PROTECTED]> writes: > I want to sort a dict via its key,but I have no idea on how to do > it.
The 'dict' type is explicitly unordered. Sorting it isn't possible. (Also note that a 'hash' is something entirely different in Python.) You can create your own type, inheriting from 'dict', that has the behaviour you want. See the Python Cookbook for some examples. <URL:http://aspn.activestate.com/ASPN/Python/Cookbook/> -- \ "I cannot conceive that anybody will require multiplications at | `\ the rate of 40,000 or even 4,000 per hour ..." -- F. H. Wales, | _o__) 1936 | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list