Append One String to Another in Python

The simplest way to append one string to another is by using the addition operator. The same as you use to add two numbers.

This code concatenates two strings and displays the result to the console.

This is text

Notice, that the post_text variable has a space before the text. It’s important for separating words.

If you have a list of words that you want to join, but there are no spaces between them, you can add words to a list and merge them with the join function.

Space before join is a separator to separate the words. This is the result.

This is text.

Append Words using the For Loop

A string in Python is a list of characters. You can loop through each element of a string and add them to the end of another string.

With each step inside the loop, the variable is printed out to the console.

This is 
This is t
This is te
This is tex
This is text
This is text.
Final result: This is text.