The join() method is a string method and returns a string in which the elements of sequence have been joined by str separator.
string_name.join(iterable) string_name: It is the name of string in which joined elements of iterable will be stored.
Parameters: The join() method takes iterable – objects capable of returning its members one at a time. Some examples are List, Tuple, String, Dictionary and Set
Return Value: The join() method returns a string concatenated with the elements of iterable.
Type Error: If the iterable contains any non-string values, it raises a TypeError exception.
Below program illustrates the working of join() method:
Joining with empty string.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.