I have a list and string:
fruits = [\'banana\', \'apple\', \'plum\'] mystr = \'i like the following fruits: \'
How can I concatenate them s
You can use this code,
fruits = ['banana', 'apple', 'plum', 'pineapple', 'cherry'] mystr = 'i like the following fruits: ' print (mystr + ', '.join(fruits))
The above code will return the output as below:
i like the following fruits: banana, apple, plum, pineapple, cherry