How to convert a list to string in Python?


I have a list like below,

a = ["x","y","z"]

I want to convert the list into a string like x/y/z How to do that?

1 Answer

4 years ago by

To convert a list to string, we can use the join() method

l = ["x","y","z"]
s = "/".join(l)
print(s)
4 years ago by Divya