Python program to convert a list to String :
In this example, we will learn how to convert a list to string. To achieve this, we will use join method of String. join is defined as below :
The iterable passed to the join method should contain only string values. If it contains any non-string value, it will throw one TypeError. The value str is the separator string, i.e. the string that will be used to separate each element of the iterable. Let’s take a look into the program :
Python program :
The example programs are available here.
one two three four five six
Let’s try by changing the separator to ‘,’.
Output is :
Now, if we change one item of the list to an integer, it will produce the following output :