Use Special Characters In Python

Sometimes, we want to add some extra space between two words, like pressing Tab key (which is identical up to 4x space-button length). In Python you have to make use of special characters in addition with a backslash (\). So for example:

print("Hello \tWorld")

Otherwise you can use concatenation using the + sign between strings, but this is not necessary. For example,

print("Hello" + "\t" + "world")

Both ways, will have the same result. This is the output:

Hello  World

Personally, I prefer the first way. It’s quicker, simpler and more close to C-style syntax.