It's because any iterable can be joined (e.g, list, tuple, dict, set), but its contents and the "joiner" must be strings.

For example:

'_'.join(['welcome', 'to', 'stack', 'overflow'])
'_'.join(('welcome', 'to', 'stack', 'overflow'))
'welcome_to_stack_overflow'

Using something other than strings will raise the following error:

TypeError: sequence item 0: expected str instance, int found

Answer from recursive on Stack Overflow
Top answer
1 of 10
1480

It's because any iterable can be joined (e.g, list, tuple, dict, set), but its contents and the "joiner" must be strings.

For example:

'_'.join(['welcome', 'to', 'stack', 'overflow'])
'_'.join(('welcome', 'to', 'stack', 'overflow'))
'welcome_to_stack_overflow'

Using something other than strings will raise the following error:

TypeError: sequence item 0: expected str instance, int found

2 of 10
489

This was discussed in the String methods... finally thread in the Python-Dev achive, and was accepted by Guido. This thread began in Jun 1999, and str.join was included in Python 1.6 which was released in Sep 2000 (and supported Unicode). Python 2.0 (supported str methods including join) was released in Oct 2000.

  • There were four options proposed in this thread:
    • separator.join(items)
    • items.join(separator)
    • items.reduce(separator)
    • join as a built-in function
  • Guido wanted to support not only lists and tuples, but all sequences/iterables.
  • items.reduce(separator) is difficult for newcomers.
  • items.join(separator) introduces unexpected dependency from sequences to str/unicode.
  • join() as a free-standing built-in function would support only specific data types. So using a built-in namespace is not good. If join() were to support many data types, creating an optimized implementation would be difficult: if implemented using the __add__ method then it would be O(n²).
  • The separator string (separator) should not be omitted. Explicit is better than implicit.

Here are some additional thoughts (my own, and my friend's):

  • Unicode support was coming, but it was not final. At that time UTF-8 was the most likely about to replace UCS-2/-4. To calculate total buffer length for UTF-8 strings, the method needs to know the character encoding.
  • At that time, Python had already decided on a common sequence interface rule where a user could create a sequence-like (iterable) class. But Python didn't support extending built-in types until 2.2. At that time it was difficult to provide basic iterable class (which is mentioned in another comment).

Guido's decision is recorded in a historical mail, deciding on separator.join(items):

Funny, but it does seem right! Barry, go for it...
--Guido van Rossum

🌐
GeeksforGeeks
geeksforgeeks.org › python › python-string-join-method
Python String join() Method - GeeksforGeeks
Learn-Python-Fast · Explanation: ... The string placed between elements of the iterable. iterable: A sequence of strings (e.g., list, tuple etc) to join together....
Published: November 18, 2025
🌐
W3Schools
w3schools.com › python › python_lists_join.asp
Python - Join Lists
There are several ways to join, or concatenate, two or more lists in Python.
🌐
BlueVPS
bluevps.com › blog › python join(): a complete guide to merging lists and python string join
A Complete Guide to Merging Lists and Python String Join - BlueVPS.com
June 18, 2025 - When you have a list of words and want to form a sentence or structured string, join() is the ideal method. It's useful for creating readable outputs like CSV lines, messages, or log entries.
🌐
Hyperskill
hyperskill.org › university › python › join-method-in-python
Python join() Method: Join Strings from a List (with Examples)
June 5, 2026 - The join() function in Python is used to merge items from a collection, such as a list or tuple, into a single string. It takes a separator and combines the elements of the collection with that separator in between.
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-join-list
Join Python List: Methods, Examples, and Best Practices | DigitalOcean
Learn how to join a Python list using join(), +, extend(), and itertools.chain(). See real code examples, benchmarks, and best practices.
Find elsewhere
🌐
Mimo
mimo.org › glossary › python › string-join-method
Python's String Join Method: Efficient String Concatenation
The Python String join() method joins elements of a list, string, or tuple into a single string, separated by a string.
🌐
Built In
builtin.com › data-science › merging-lists-in-python
Merging Lists in Python | Built In
June 17, 2025 - In this first example, we’re going to join all strings in the list when the separator is given as space. num1=["Welcome", "to", "python", "programming", "language"] num2=" ".join(num1) print (num2) #Output:Welcome to python programming language
🌐
Reddit
reddit.com › r/learnpython › function to join list items into string with delimiter
r/learnpython on Reddit: Function to join list items into string with delimiter
July 29, 2024 -

How would I turn the following code into a function? The goal is to take a list of colors and return a string with "+" in between each color from the list. The code below returns: the best colors are : blue + yellow.

I'm looking to create a function colors(): in which I could pass any list of colors instead of hardcoding it below. For example, colors(['green', 'red', 'black']) would return: the best colors are : green + red + black

input_list = ['blue', 'yellow']

delim = " + "

res = delim.join([str(ele) for ele in input_list])

print('the best colors are' + ' : ' + str(res))

🌐
Reddit
reddit.com › r/python › how do i concatenate two lists in python?
r/Python on Reddit: How do I concatenate two lists in Python?
May 8, 2023 - Well it looks liek CHatGPT has really outdone itself this time by providing us with such groundbreaking information on adding two numbers in Python! I would've never thought of the + operator /s · [deleted] • · 3y ago · Lol, maybe I should define a custom data class that has a custom “add_other_list” method. Then instantiate that thing twice, one for each list, and then call the method. More replies · Raschlenitel • · 3y ago · list_1.extend(list_2) Py_Ezra • · 3y ago · Use join method Newlist = list1 + list2 ·
🌐
W3Schools
w3schools.com › python › gloss_python_join_lists.asp
Python Join Two Lists
Remove List Duplicates Reverse a String Add Two Numbers · Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Training ... There are several ways to join, or concatenate, two or more lists in Python.
🌐
Medium
allwin-raju.medium.com › mastering-pythons-join-method-0ac455236f7f
Mastering Python’s join() Method
February 11, 2025 - Read for free: https://allwin-...79a6a541988d6b1ea5decb47ea90 · The join() method takes an iterable (like a list or tuple) and joins its elements into a string, using the specified separator....
🌐
Programiz
programiz.com › python-programming › methods › string › join
Python String join()
Note: The join() method provides a flexible way to create strings from iterable objects. It joins each element of an iterable (such as list, string, and tuple) by a string separator (the string on which the join() method is called) and returns the concatenated string.
🌐
YouTube
youtube.com › shorts › soVwxvM5OAM
Join a Python List to a String! #python #coding - YouTube
To join a Python list of string characters follow the steps below.Join Without Spaceschar_list = ["a","b","c","d"]str_letters = "".join(char_list)Join With S...
Published: December 10, 2024
🌐
docs.python.org
docs.python.org › 3 › library › stdtypes.html
Built-in Types — Python 3.13.6 documentation
The following sections describe the standard types that are built into the interpreter. The principal built-in types are numerics, sequences, mappings, classes, instances and exceptions. Some colle...
🌐
Real Python
realpython.com › python-join-string
How to Join Strings in Python – Real Python
October 22, 2025 - You use .join() in Python to combine ... inserted between each substring. To join list elements, you call .join() on a separator string, passing the list as the argument....
🌐
freeCodeCamp
freecodecamp.org › news › python-join-how-to-combine-a-list-into-a-string-in-python
Python join() – How to Combine a List into a String in Python
January 3, 2023 - We can combine tuple items together ... list items together using join(): ... This is useful for cases where we need to use tuples – like storing large collections of items which need to be processed only once and then displaying the items ...
🌐
Centron
centron.de › home › tutorials › python join list - tutorial
Python Join List - Tutorial – centron
February 7, 2025 - List must contain only the String values. We can use join() function to split a string with specified delimiter too. ... names = 'Python' delimiter = ',' single_str = delimiter.join(names) print('String: {0}'.format(single_str))
🌐
Python Reference
python-reference.readthedocs.io › en › latest › docs › str › join.html
join — Python Reference (The Right Way) 0.1 documentation
>>> ''.join(['A', 'B', 'C']) 'ABC' >>> ''.join({'A': 0, 'B': 0, 'C': 0}) # note that dicts are unordered 'ACB' >>> '-'.join(['A', 'B', 'C']) # '-' string is the seprator 'A-B-C'
🌐
GeeksforGeeks
geeksforgeeks.org › python › join-list-with-separator-in-python
Join List With Separator in Python - GeeksforGeeks
July 23, 2025 - The method is optimized and handles large lists efficiently, making it ideal for most use cases. ... Explanation: sep.join(a) joins all elements of the list a using the separator sep .