[FRPythoneers] Question about string.join method

J. Wayde Allen wallen at its.bldrdoc.gov
Mon Apr 30 16:24:55 MDT 2001


On Mon, 30 Apr 2001 jafo at tummy.com wrote:

>    intervening occurences of sep.  Sep defaults to a single
>    space.
> 
>    (join and joinfields are synonymous)

Yes, this much I had figured out.

> In this case, "list" as the argument is kind of mis-leading.  It actually
> takes a sequence.  A list is a sequence, but so is a string. 

This is what I got wrong.

> Your original "field[2] + field[3]" was correct.  It can also be written
> as:
> 
>    res = '%s%s' % ( field[2], field[3] )
>    res = string.join(( field[2], field[3] ), '')

OK I see that now.  Wouldn't have thought about the 

    res = '%s%s' % (field[2], field[3] )

one though.  Is there any particular advantage to one of these methods
over any other?

- Wayde
  (wallen at its.bldrdoc.gov)




More information about the FRPythoneers mailing list