1# Python program to convert a list
2# to string using list comprehension
3
4s = ['I', 'want', 4, 'apples', 'and', 18, 'bananas']
5
6# using list comprehension
7listToStr = ' '.join([str(elem) for elem in s])
8
9print(listToStr)
1list_of_num = [1, 2, 3, 4, 5]
2# Covert list of integers to a string
3full_str = ' '.join([str(elem) for elem in list_of_num])
4print(full_str)
1List = ["ITEM1", "ITEM2", "ITEM3"]
2string_version = "".join(List)
3
4print(string_version)
5
1mystring = 'hello, world'
2
3myarray = string1.split(', ') #output => [hello, world]
4
5myjoin1 = ', '.join(myarray) #output => hello, world
6myjoin2 = ' '.join(myarray) #output => hello world
7myjoin3 = ','.join(myarray) #output => hello,world