Python - Data Type String concatenation

Introduction

As sequences, strings support concatenation with the plus sign.

It joins two strings into a new string.

You can do repetition: making a new string by repeating another:

Demo

S = 'Spam'        # Make a 4-character string, and assign it to a name 
print( S )
print( S + 'xyz' )# Concatenation 
print( S )        # S is unchanged 
print( S * 8 )    # Repetition
#   ww w  .  ja v  a  2 s . co m

Result

Related Topic