How to concatenate strings in Python?

By Lenin Mishra

If you prefer to watch Youtube videos over reading blogs, check out our video on Python strings here.

Concatenating strings in Python

Concatenation is joining of two or more strings into a single string.

In Python, the + operator is used for concatenation. You can also concatenate two strings by writing them together. Another way is to use the * operator to repeat the string for a given number of times.

Code

str1 = "I like "
str2 = "Pylenin"

print(str1+str2)

print(str1, str2)

print(str1*2)

Output

I like Pylenin
I like  Pylenin
I like I like 
  1. How to create a string in Python?
  2. How to access characters in a Python string?
  3. How to replace characters in a string in Python?
  4. How to iterate through a string in Python?
  5. Check if a Substring is Present in a Given String in Python
  6. Escape sequences in Python String
  7. Python String Formatting - The Definitive Guide
  8. Commonly used Python string methods