inhahe wrote: > 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
Please test before posting. >>> compress_str("AAAABBBBCCCCC") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 5, in compress_str AttributeError: 'str' object has no attribute 'append' Regards, Björn -- BOFH excuse #48: bad ether in the cables -- http://mail.python.org/mailman/listinfo/python-list