I want to know the other way of concatenating string items in the form of the list into a single string. Is this str.join() function can be used?
Let's say this is the input:
['this','is','a','sentence']
And this is the desired output:
this-is-a-sentence
sentence = ['this','is','a','sentence']
sent_str = ""
for i in sentence:
sent_str += str(i) + "-"
sent_str = sent_str[:-1]
print sent_str