String Concatenation with + and .join() in Python


Combine strings using + or .join() for efficiency with lists of strings.

Source Code

# Using +
greeting = "Hello" + " " + "World!"

# Using .join()
words = ["Hello", "World!"]
greeting = " ".join(words)
print(greeting)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments