Tag Archives: string addition in Python

How to build up a large string out of smaller strings in Python

Let’s say you may want to construct a big string from smaller strings in Python. The solution is simple and it is called concatenation. As in Math, you can use the addition operator, which is +, to put one or more strings together and return a larger string.

>>> s1 = 'My name '
>>> s2 = 'is Dan.'
>>> new_string = s1 + s2
>>> print(new_string)
My name is Dan.

Continue reading