evenOrOdd = True s1, s2 = "hi_cat_bye_dog_foo_bar_red", ""
for i in s1: if i == '_': s2 += ':' if evenOrOdd else ',' evenOrOdd = not evenOrOdd else: s2 += i print s2 Presently I cannot work out how to use .join instead of += ... While I realise this is producing a new string (and I believe += rebuilds it a lot?) how much slower is this going to be over the others? -- http://mail.python.org/mailman/listinfo/python-list