How to Join Strings in Python with + (Plus)
The simplest way to join two pieces of text in Python is +: "Bike" + "shop" gives "Bikeshop". Add a space or a line break as a string of its own, and convert numbers to text first. This guide joins a few strings on Python 3.15.2.
Syntax
<joined> = <string 1> + <string 2>
| Part | What it means |
|---|---|
<string 1>, <string 2> | Two strings. Both sides must be text |
+ | Joins them: the second goes straight after the first, with nothing in between |
Python's built-in types reference lists s + t as "the concatenation of s and t".
The Example
The script joins Bike and shop with a space between them, then joins two lines with a line break.
Prerequisites
- uv and Python 3. This guide uses uv 0.13.10 with Python 3.15.2, in a project made with
uv init.
Step 1: Write the Script
first = "Bike"
second = "shop"
print(first + " " + second)
print("Line one" + "\n" + "Line two")

Step 2: Run It
uv run python join_strings.py
Bike shop
Line one
Line two

The space between Bike and shop came from the " " in the middle; + adds nothing by itself. "\n" joined the two lines with a line break. The command works unchanged in PowerShell.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Adding a number to text: "Gears: " + 7 | TypeError: can only concatenate str (not "int") to str | Convert it first: "Gears: " + str(7) printed Gears: 7 |
Expecting + to add a space | "Bike" + "shop" gives Bikeshop | Add the space yourself: "Bike" + " " + "shop" |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
can only concatenate str (not "int") to str | One side of + is a number | Wrap the number in str() |
| Words run together | No space between the pieces | Add " " between them |
FAQ
Is + the only way?
No. An f-string, such as f"{first} {second}", puts values into text without +, and converts numbers for you.
Does + change the original strings?
No. The reference says "Strings are immutable sequences of Unicode code points", so + builds a new string and leaves the originals as they were.
Conclusion
first + " " + second gave Bike shop, and "\n" between two strings put them on separate lines. Both sides of + must be text, so wrap numbers in str().
Additional Resources
- Common sequence operations —
+and the other operations on strings. - Text sequence type, str — everything about strings.
