Continuation Character in Python

By Hemanta Sundaray on 2021-08-28

The readability of your program will suffer if you have code lines that are more than, let’s say 80 characters long.

In such cases, you can use the continuation character (the backslash character) at the end of a line and Python will act as though you are still on the same line.

Example:

addition = 1 + \
           2 + \
           3

print(addition)
# 6

Join the Newsletter