1>>> sentence = ['this','is','a','sentence']
2>>> '-'.join(sentence)
3'this-is-a-sentence'
1list = ['Add', 'Grepper', 'Answer']
2Inline
3> joined = " ".join(list)
4> Add Grepper Answer
5Variable
6> seperator = ", "
7> joined = seperator.join(list)
8> Add, Grepper, Answer
1# example of join() function in python
2
3numList = ['1', '2', '3', '4']
4separator = ', '
5print(separator.join(numList))
1# use of join function to join list
2# elements without any separator.
3
4# Joining with empty separator
5list1 = ['g','e','e','k', 's']
6print("".join(list1))
7
8#Output:
9geeks