join
Creates a string that is composed of the provided string
s joined together with the specified separator.
join(separator, listOfStrings)
# Or
join(separator, ...args)
#
Parametersseparator
: Separator used to join stringslistOfStrings
: Alist
ofstring
s that need to be joined togetherargs
: String arguments that need to be joined together
#
Returns- The composed
string
#
Example# Strings as listprint(join(' ', ['apple', 'banana', 'mango'])) # prints: apple banana mango
# Strings as argsprint(join(', ', 'apple', 'banana', 'mango')) # prints: apple, banana, mango