Converting a list to a string in python
1 min read

Converting a list to a string in python

Here I am converting a list of strings to a single string and placing a comma between each item in the new string.

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# convert list to string with removed []
LIST = ['first', 'second', 'third', 'fourth']
str_list = (", ".join(LIST))

This is the output:

print str_list
>> 'first, second, third, fourth`