You can use str.format
, and str.join
to get your required output.
Ex:
fruits = ['banana', 'apple', 'plum']
mystr="i like the following fruits: \n\n{}".format("\n".join(fruits))
print(mystr)
Output:
i like the following fruits: banana, apple, plum
3
solved Concatenate string & list [duplicate]