0
Ques for string's joining
Hi guys. Any difference between + and , when we use for joining string's purpose. It just the same and ' , ' just put space between each word or more something else. Tks in advance.
2 Réponses
0
Is it Python?
Consider you have a very long list of strings. You wouldn't want to concatenate its elements "manually" with +. the .join() method comes very handy here and you only have to type your separator once.
0
Hi!
One more thing is when you're using "+" symbol as concat operator, you have to use str() function to integers to convert them as strings in strings - integers concatenation. But this is not required for "," concat operator.
I show you some examples below.
name = "John"
age = 30
print(name+"is"+str(age)) -> ✔
print(name+"is"+30) -> X
print(name,"is",age)