Tuesday, July 9, 2019

python string concatenation

Python string concatenation



#Python String concatenation Example

a = "Python"
b = "scripting"

print (a+b)
#output
#Pythonscripting

# Adding space in two word
print (a+" "+b)
#Python scripting

#Adding new line between words
print (a+'\n'+b)
#Python
#scripting

#concatenation using Join
print (' '.join([a, b]))
#Python scripting


#two String join
print (' '.join(["Hello", "World"]))
#Hello World

#Join using different character
print (','.join(['apple','banana','strawberry']))
#apple,banana,strawberry

x="hello"
y="world"
result = x+y
print (result)
#helloworld

result = 'Hello' +' ' +'World'
print (result)
#hello world

1 comment:

  1. Great Article. I found so many interesting stuff in your blog Helped a lot in increasing my knowledgevisit site

    ReplyDelete

Wireless Security Configuration: Protect Your Network Now!

Introduction: In today’s connected world, wireless networks are as common as smartphones, and they’re often the gateway to our personal, pr...