Python Indentation


In Python the indentation of statements is significant and the interpreter generates error messages for improper indentation.

It is important that no whitespace (spaces or tabs) come before the beginning of each statement.

Indentation cannot be split over multiple physical lines using backslashes; the whitespace up to the first backslash determines the indentation.


Incorrect Way of Indentation in Python

Incorrect Way of Indentation



Correct Way of Indentation in Python
Correct Way of Indentation



Comments