Say I have a sequence seq and a string s, and I call s.join(seq).
Here's what it does:
s.join(seq) == seq[0] + s + seq[1] + s + seq[2] + s + ... + seq[-2] +
s + seq[-1]
So if you call 'abc'.join('ABC'), you get:
'ABC'[0] + 'abc' + 'ABC'[1] + 'abc' + 'ABC'[2]
which is:
'A' + 'abc' + 'B' + 'abc' + 'C'
Hope this helps.
--
John.
John,
Your explanation is very help. It does make be wonder the usefulness
of join with strings. Do you have a practical example/situation?
Steve
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor