text.join

text.join(list, "separator")

Returns a string containing all items in a list of strings joined with the specified separator. Returns an empty string when the list is empty. Where the list only contains one item, it returns the unmodified item; no separator is appended.

For example:

input_list

One
Two
Three
Four

text.join(input_list, ", ") returns:

One, Two, Three, Four
Was this page helpful? Yes No Submitting... Thank you

Comments