TypeError: can only concatenate str (not "int") to str
You joined a string and a non-string with +.
Seen on:
Python
Meaning
String concatenation requires both sides to be str. Convert the number, or better, use an f-string.
Common causes
- "Total: " + total where total is an int
- Concatenating None or a list
- Building paths with + instead of os.path/pathlib
⚡ Quick fix
- Use f-strings: f"Total: {total}"
- Wrap with str()
- Use pathlib for paths
Detailed fix by platform
Python
print(f"Processed {count} rows in {elapsed:.2f}s")
How to diagnose
- Operands — Which value is not a string?
- Intent — Formatting text or adding numbers?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026