Remove duplicate letters in a word

Andrew Wilkinson ajw126 at NOSPAMyork.ac.uk
Mon Jun 23 07:43:10 EDT 2003


Eliran Gonen wrote:
> 
> Hope you can help me,
> 

I know there have been several suggestions already, but here's what I'd
do...

def nodups(s):
    return filter(lambda c, seen=[]:(c not in seen) and (not
seen.append(c)), s)

HTH,
Andrew Wilkinson






More information about the Python-list mailing list