Compressing a text file using count of continous characters

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri Dec 14 11:59:08 EST 2007


On Fri, 14 Dec 2007 08:54:58 -0800, nirvana wrote:

> I need to count the number of continous character occurances(more than
> 1) in a file, and replace it with a compressed version, like below
> XYZAAAAAAAADEFAAcdAA --> XYZ8ADEF2Acd2A

Great.  Then go ahead an implement it.  :-)

`itertools.groupby()` might be handy.

And you have to think about digits in the source if that's allowed.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list