Alan G Isaac: > Probably not what you had in mind ... > ... > >>> maxlen = max(len(si) for si in s) > >>> def k(si): return si+'z'*(maxlen-len(si))
This looks a little better: assert isinstance(s, str) sorted(s, key=lambda p: p.ljust(maxlen, "\255")) If the string is an unicode that may not work anymore. I don't know if there are better solutions. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list