On 29.05.2013 05:20, Jim Mooney wrote:
On 28 May 2013 19:34, Steven D'Aprano <st...@pearwood.info> wrote:
The standard method for assembling a string from a collection
of substrings is to do it in one go, using the join method,
Wow, that means I can do this: print ''.join('But this parrot is dead!')
But why do you want to do that?
"join" iterates over the string you gave as an argument and puts the
empty string in between each character:
'B' + '' + 'u' + '' + 't' + '' + ...
Thus you end up with the same string as you started.
Or did you mean something like:
>>> print '<>'.join('But this parrot is dead!')
B<>u<>t<> <>t<>h<>i<>s<> <>p<>a<>r<>r<>o<>t<> <>i<>s<> <>d<>e<>a<>d<>!
Bye, Andreas
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor