On Jan 11, 9:31 am, [EMAIL PROTECTED] wrote: > 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 += ... Do s2 = [] then later: s2.append(i)
and at the end: print ''.join(s2) - Paddy. > 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