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.

11th Aug 2021, 4:05 PM
Tiến Đạt Nguyễn Bá
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.
11th Aug 2021, 4:17 PM
Lisa
Lisa - avatar
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)
12th Aug 2021, 6:20 AM
Python Learner
Python Learner - avatar