Articles → Python → Concatenate string in python

Concatenate string in python






Syntax


“string 1” + “string 2”





Example




welcome = "Welcome"
firstname = "Karan"
lastname ="gupta"


fullmessage = welcome +" " + firstname + " "+ lastname

print (fullmessage)





Click to Enlarge


Concatenating substring




welcome = "Welcome"
firstname = "Karan"
lastname ="gupta"


fullmessage = welcome[0:1] +" " + firstname[0:1] + " "+ lastname[0:1]

print (fullmessage)





Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Friday, February 01, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250