I have the following list:
sentence = ['doc1','doc2','doc3','doc4']
How can I concatenate .txt at the end of each elment of sentece? (*):
['doc1.txt','doc2.txt','doc3.txt','doc4.txt']
I tried to list comprehension:
'.txt '.join(sentence[:-1])
Nonetheless, it returns this:
'doc1.txt doc2.txt doc3'
Which is wrong, since it's different from (*)