i see lots of neat one-liner solutions but just for the sake of argument:
def compress_str(str):
new_str = ""
lc = ""
for c in str:
if c != lc: new_str.append(c)
return new_str
"Matt Porter" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi guys,
>
> I'm trying to compress a string.
> E.g:
> "AAAABBBC" -> "ABC"
>
> The code I have so far feels like it could be made clearer and more
> succinct, but a solution is currently escaping me.
>
>
>
>
> Cheers
> Matt
> --
> --
>
--
http://mail.python.org/mailman/listinfo/python-list