Paul Rubin wrote: > George Sakkis <[EMAIL PROTECTED]> writes: > >> from itertools import chain, izip, cycle >> print ''.join(chain(*izip(s1.split('_'),cycle(':,'))))[:-1] >> > > from itertools import cycle > a = cycle(':,') > print re.sub('_', lambda x: a.next(), s1) >
Lovely. If there OP didn't vanished into thin air*, I'd declare you the winner (although you forgot to import re). This said, I'm still kind of partial to any re-only solution, but it would require someone outlines the behavior in the corner cases. * die, thread! -- Pablo -- http://mail.python.org/mailman/listinfo/python-list