Oops: difference in operation of string.join and ''.join
Erik Max Francis
max at alcyone.com
Sun Oct 21 17:13:30 EDT 2001
John Thingstad wrote:
> >>> ''.join([x+y for x, y in zip('test', 'dust')])
> 'tdeusstt'
> >>> import string
> >>> string.join([x+y for x, y in zip('test', 'dust')])
> 'td eu ss tt'
>
> What is this?
That's because they're not equivalent. string.join and ' '.join would
be, though.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ Scars are like memories. We do not have them removed.
\__/ Chmeee
Maths reference / http://www.alcyone.com/max/reference/maths/
A mathematics reference.
More information about the Python-list
mailing list