What is the recommended indentation size in Python?

Is there an official rule / suggestion on how Python code is indented?

+5
source share
2 answers

From PEP 8 (official Python manual style):

Use 4 spaces at the indent level.

+18
source

4 spaces or press the tab button once. However, try to avoid the tab button. Sometimes this gives you indentation errors, even if you indented correctly.

0
source

All Articles