Daftar ke String Python
list1 = [1, 2, 3]
str1 = ''.join(str(e) for e in list1)
Amused Antelope
list1 = [1, 2, 3]
str1 = ''.join(str(e) for e in list1)
>>> import ast
>>> x = '[ "A","B","C" , " D"]'
>>> x = ast.literal_eval(x)
>>> x
['A', 'B', 'C', ' D']
>>> x = [n.strip() for n in x]
>>> x
['A', 'B', 'C', 'D']
list1 = ['1', '2', '3']
str1 = ''.join(list1)
list_of_num = [1, 2, 3, 4, 5]
# Covert list of integers to a string
full_str = ' '.join([str(elem) for elem in list_of_num])
print(full_str)
my_list = ["Hello", 8, "World"]
string = " ".join(my_list)
print(string)
"""
output
Hello 8 World
"""
>>> L = [1,2,3]
>>> " ".join(str(x) for x in L)
'1 2 3'