Skip to content

list to string python

smart1004 edited this page Oct 27, 2018 · 2 revisions

list to string python list1 = ['1', '2', '3'] str1 = ''.join(list1)

list1 = [1, 2, 3] str1 = ''.join(str(e) for e in list1)

l = [1, "foo", 4 ,"bar"] ",".join(str(bit) for bit in l) '1,foo,4,bar'

Clone this wiki locally