This post will discuss how to concatenate items present in a Python list into a string separated by a delimiter.

1. Using join() function

To efficiently concatenate items in the list with a preferred delimiter, the recommended solution is to call the join() function on the delimiter, i.e., delim.join(list).

Download  Run Code

2. Using reduce() function

Another plausible way to construct a string out of a list is to reduce with a custom function. Here’s a working example:

Download  Run Code

 
Here’s another variation that uses lambda expression.

Download  Run Code

That’s all about concatenating items in the list into a string in Python.