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

Ethical Hacking Techniques: Cracking WPA/WPA2 Wi-Fi Using WPS and Capturing Handshakes

In the realm of cyber security, ethical hacking plays a crucial role in identifying and addressing vulnerabilities. One of the areas where e...