Use str.join:

>>> words = ['this', 'is', 'a', 'sentence']
>>> '-'.join(words)
'this-is-a-sentence'
>>> ' '.join(words)
'this is a sentence'
Answer from Burhan Khalid on Stack Overflow
Discussions

How do I concatenate two lists in Python?
Use the + operator. More on reddit.com
๐ŸŒ r/Python
25
35
May 8, 2023
python - How to concatenate a string and a list? - Stack Overflow
I have a list and a string: fruits = ['banana', 'apple', 'plum'] mystr = 'i like the following fruits: ' How can I concatenate them so I get 'i like the following fruits: banana, apple, plum' Kee... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Function to join list items into string with delimiter
You have nearly everything already, just need to move it into a function? Like this: def colors(input_list): delim = " + " combined = delim.join([str(ele) for ele in input_list]) res = 'the best colors are' + ' : ' + str(combined) return res print(colors(['green', 'red', 'black'])) (ib4 others saying it could be shorter: yes, but we need to keep it readable and understandable for OP) More on reddit.com
๐ŸŒ r/learnpython
5
3
July 29, 2024
Python concat string with list - Stack Overflow
I wanted to build a string from a list. I used the string.join() command, but if I have : ['hello', 'good', 'morning'] I get : hellogoodmorning Is there a method that allows me to put a space be... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Concatenate Strings in Python: +, +=, join(), and more | note.nkmk.me
May 19, 2025 - ... s = f'{s1}_{i:05}_{s2}_{f:.5f}' print(s) # aaa_00100_bbb_0.25000 s = f'{s1}_{i}_{s2}_{f}' print(s) # aaa_100_bbb_0.25 ... You can concatenate a list of strings into a single string using the string method join().
๐ŸŒ
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 - unpacking to concatenate (not often, but sometimes). [*list1, *list2] can be easier to read on occasion. ... And it's not a built-in, it's in the standard library. ... You ask either google or ChatGPT. ... I just asked ChatGPT to write an article about the various ways to add 2 numbers in Python.
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ string-join-method
Python's String Join Method: Efficient String Concatenation
Use an Empty Separator for Direct Concatenation: To join a list of characters or strings into one without any separator, use an empty string: "".join(['p', 'y', 't', 'h', 'o', 'n']) results in 'python'.
๐ŸŒ
Real Python
realpython.com โ€บ python-string-concatenation
Efficient String Concatenation in Python โ€“ Real Python
September 9, 2025 - By the end of this tutorial, youโ€™ll understand that: You can concatenate strings in Python using the + and += operators. You can use += to append a string to an existing string. The .join() method is used to combine strings in a list in Python.
Find elsewhere
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ joining-lists-in-python-how-to-concat-lists
Joining Lists in Python โ€“ How to Concat Lists
March 14, 2023 - By concatenating an existing list with another iterable object, the extend() method of lists in Python enables you to add multiple elements to an existing list. ... Here, iterable is any iterable object (such as a list, tuple, string, etc.) that contains the elements you want to add to the list, and list_name is the name of the list to which you want to add elements.
๐ŸŒ
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))

๐ŸŒ
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 - If the list contains integers or other types, Python will raise a TypeError. ... The Python list join() method is used to combine a list of strings into one single string, inserting a specified separator between each element.
๐ŸŒ
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.
๐ŸŒ
AbsentData
absentdata.com โ€บ home โ€บ articles โ€บ python list concatenation: best practices
Python List Concatenation: Best Practices - AbsentData
November 12, 2023 - To concatenate lists we can use itertools.chain() function offered by itertools modules in Python. It is used to concatenate different iterable objects like lists, strings, tuples, and dictionaries in a memory-efficient way.
๐ŸŒ
Earthly
earthly.dev โ€บ blog โ€บ python-concatenate-lists
Python Concatenate Lists - Earthly Blog
July 14, 2023 - In almost all simple situations, using list1 + list2 is the way you want to concatenate lists. The edge cases below are better in some situations, but + is generally the best choice.
๐ŸŒ
DataCamp
datacamp.com โ€บ tutorial โ€บ python-concatenate-strings
Python Concatenate Strings Tutorial | DataCamp
July 25, 2024 - In Python, there are multiple ways to concatenate strings, each with its own advantages. The + operator is simple and direct, join() is efficient for lists, f-strings offer readability and performance, % provides a classic approach, and format() offers versatility.
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ concatenate-lists-python
6+ Ways to Concatenate Lists in Python | DigitalOcean
Learn to concatenate lists in Python with examples, pros/cons, and performance tips. Explore Python list concatenation arrays without NumPy.
๐ŸŒ
DataCamp
datacamp.com โ€บ tutorial โ€บ how-to-convert-a-list-to-a-string-in-python
How to Convert a List to a String in Python | DataCamp
April 12, 2024 - Learn various methods to concatenate strings in Python, with examples to illustrate each technique. ... Learn about Python List functions and methods. Follow code examples for list() and other Python functions and methods now! ... In this tutorial, you'll learn all about Python Strings: slicing and striding, manipulating and formatting them with the Formatter class, f-strings, templates and more! ... Compare between 8 different methods for finding the length of ...
๐ŸŒ
Pandas
pandas.pydata.org โ€บ docs โ€บ reference โ€บ api โ€บ pandas.concat.html
pandas.concat โ€” pandas 3.0.6 documentation
Concatenate pandas objects along a particular axis. Allows optional set logic along the other axes. Can also add a layer of hierarchical indexing on the concatenation axis, which may be useful if the labels are the same (or overlapping) on the passed axis number.
๐ŸŒ
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.
๐ŸŒ
Real Python
realpython.com โ€บ python-join-string
How to Join Strings in Python โ€“ Real Python
October 22, 2025 - What can I use instead of .join() in Python?Show/Hide ยท For simple concatenation of a few strings, you can use the concatenation operator (+) or string interpolation with f-strings.