This post will discuss how to convert a list to a string in Python.

The preferred and fast way to concatenate the strings in iterable is with the str.join() function. The following code example shows how to implement this:

Download  Run Code

 
Note that TypeError will be raised for any numeric values in iterable. To convert a list of integers to a string, you have to first convert each of the non-string values present in the iterable to a string. You can do this in the following ways:

1. Using Generator Expression

You can use a generator to easily convert the list of integers to a string, as shown below:

Download  Run Code

2. Using map() function

It is preferable to use the map() function instead, which efficiently converts a list of integers to a string.

Download  Run Code

That’s all about converting a List to a string in Python.