Fwd: Re: [jcd at sdf.lonestar.org: Re: Compress a string]

python at bdurham.com python at bdurham.com
Sun May 18 14:20:11 EDT 2008


> I'm trying to compress a string.
> E.g:
>
>  "AAAABBBC" -> "ABC"

Doesn't preserve order, but insures uniqueness:

line = "AAAABBBC"
print ''.join( set( line ) )

Malcolm



More information about the Python-list mailing list