[Tutor] Using join instead of string.joinfield

Bernard Lebel 3dbernard at gmail.com
Tue Aug 23 17:12:00 CEST 2005


Oh. Thanks a lot for that, now that you told me, the doc about join
makes lot more sense!


Thanks
Bernard


On 8/23/05, Harper, Gina <gharper at medplus.com> wrote:
> Easy.
> Suppose you want to join a list of words with hyphens.
> >>> a_list = ['this', 'is', 'a', 'list', 'of', 'words']
> >>> sep_char = '-'
> >>> print sep_char.join(a_list)
> this-is-a-list-of-words
> >>>
> *g*
> -----Original Message-----
> From: Bernard Lebel [mailto:3dbernard at gmail.com]
> Sent: Tuesday, August 23, 2005 11:04 AM
> To: Python Tutor list
> Subject: [Tutor] Using join instead of string.joinfield
> 
> 
> Hello,
> 
> The documentation says that the built-in join method now replaces the
> string.joinfield function.  However how do you achieve the same
> operation? The join method accepts only one argument, that is, the list
> of strings to join. How do you then specify the separating character?
> 
> 
> Thanks
> Bernard
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list