[Tutor] string.join()
Kent Johnson
kent37 at tds.net
Mon Nov 3 16:54:20 CET 2008
On Mon, Nov 3, 2008 at 10:54 AM, Monte Milanuk <monte at milanuk.net> wrote:
> Hello again,
>
> Just looking for clarification on a point: the book I'm using is written
> around Python v.2.3, and has an exercise using string.join(). Specifically,
> it said to use string.join(msgList, "")
> After a while
> longer, I finally noticed somewhere that 'str' was supposed to be the string
> used for the separator, so I use ''.join(msgList), which seems to work (or
> at least give identical output) in this case.
>
> So... do I have it correct? Yes/no/maybe?
Yes, that is correct. Instead of string.join(seq, sep) use sep.join(seq).
Kent
More information about the Tutor
mailing list