Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
1 like 0 dislike
in Blog Post by 48 54 93
edited by

In the previous post, we explained String in Python. In this post, we are going to learn the best ways of string concatenation in Python.

concatenate sring in python

Python represents "string" as a text, it doesn't have a "character" data type.

string in python

What is string concatenation?

In Python, there are a few ways to concatenate or combine strings, as we know everything in Python is an object, so the new string is a string object.

String concatenation in Python:

To concatenate string in Python, you can use the following:

  • + operator
  • +=  
  • Join Method

The + operator

  • Concatenate one or more string.
  • once the string object created, it can't be changed. (this means immutable)
  • It is recommended for a few strings.


firstName="Hamza "
print(firstName+lastname)# the output will be Hamza Mohammed

+= concatenate operator

Besides the + operator, we can use the += operator to concatenate string in Python.


firstName="Hamza "
print(firstName)# the output will be Hamza Mohammed

join() method

  • It is used with iterators.
  • It is recommended in case you have many strings.


colorLists=['Red', 'Yellow', 'Black']
str_concat = ", ".join(colorLists)


In this post, we have explained three-way to concatenate strings in Python.

  • + operator
  • +=  
  • Join Method

See Also

998 questions

655 answers


192k users

تعلم بالعربي PowerApps

تعلم بالعربي Power Automate

If you don’t ask, the answer is always NO!