Concatenate List of Strings in Python

In this tutorial, we will look at some of the different ways to concatenate a list of strings in Python.

 

Python Convert List of Strings to Single String Using the join() Method

The join() method joins iterables into one string. To use it, define the separator then pass the join() method with the list to concatenate as the first argument.

 

res = ' '.join([ 'a','b','c' ])

print(res)
a b c

 

Join List of Strings into One String with for Loop

Here is an example of how to concatenate a list of strings using the addition assignment operator (+=) in a for loop.

 

items = [ 'a','b','c' ]
res = ''

for i in items:
   res += i

print(res)
abc