On Tue, 20 May 2008 00:09:14 -0400 John Salerno <[EMAIL PROTECTED]> wrote:
> Not that you need help anymore, but I decided to give it a try. Not as > elegant as the one- and two-liners, but somewhat concise I guess. Whoops! Could be cleaner! :) def compress(s): new = [] for c in s: if c not in new: new.append(c) return ''.join(new) No, wait! I can do better! def compress(s): new = [] [new.append(c) for c in s if c not in new] return ''.join(new) Wow, list comprehensions are cool. -- http://mail.python.org/mailman/listinfo/python-list