On Tue, May 13, 2008 at 7:58 AM, Norman Khine <[EMAIL PROTECTED]> wrote: > how about this > > > >>> d = { 'a' : 1, 'd' : 2, 'b' : 3, 'c' : 0 } > >>> for i in sorted(set(d)): > ... print "%s\t%s" % (i, d[i])
The set() is not needed. Also to iterate over key, value pairs in order by key you can use this: for k, v in sorted(d.items()): print '%s\t%s' (k, v) Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor