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
# from  w  ww.j a v a2  s . c om

Result

Related Topic