How to join list with different types of elements in python?
python, python-2.7
Solution
Convert the items to strings first.
",".join(str(elem) for elem in list1)
or
",".join(map(str, list1))
Problem
``` list1 = [1,"3",2323,"pause"] list2 = ["2","4","5"] print ",".join(list1) print ",".join(list2) ``` For the above code, the elements of `list2` can be connected without any problems. But the join of `list1` reports error ``` TypeError: sequence item 0: expected string, int found ``` I know that `join` works only for strings, then how to join the elements of a list with different types?