How to concatenate two strings in python?

In Python programming concatenate two strings is very easy. Strings can be concatenated  with the + operator, and repeated with * operator. Examples are given below.

>>># We can see in below example how concatenate two strings using  + operator

>>> ‘Gyan’ + ‘today’


>>># We can see in below example how repeat strings using  * operator

>>> 3*’Go’+’Goa’


Also we can concatenate variables and a string literals.

>>> pre = ‘Gyan’
>>> pre + ‘today’

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.