0

How to convert list into string

Explain list to string with example

23rd Mar 2020, 1:43 PM
Bai Jilla
Bai Jilla - avatar
5 Answers
+ 6
If list contains integer values (which can not been processed with join()), or a mix of numerical values and strings, you can use a list comprehension like this: list=[1,2,3,4,5,6,'7'] print(''.join([str(i) for i in list])) # result is => 1234567
23rd Mar 2020, 5:08 PM
Lothar
Lothar - avatar
+ 1
list=[1,2,3,4,5,6,7] string="" for i in list: string+=str(i) print(string)
23rd Mar 2020, 1:57 PM
Lance Ryder Wilson
Lance Ryder Wilson - avatar
+ 1
" ".join("your list").
23rd Mar 2020, 2:30 PM
Justus
Justus - avatar
0
this is way to convert list into string # Python program to convert a list # to string using join() function # Function to convert def listToString(s): # initialize an empty string str1 = " " # return string return (str1.join(s)) # Driver code s = ['Geeks', 'for', 'Geeks'] print(listToString(s)) or simply add " " amoung the inputs
23rd Mar 2020, 3:10 PM
Deva Rohinth
Deva Rohinth - avatar