在 Google Colab 中更改缩进级别

Change indentation level in Google Colab

我正在使用 Google Colab to write Python code in their notebooks. Whenever I hit enter after a loop or conditional, the new line is automatically indented, which is good, but it uses only 2 whitespaces by default. This is contrary to the PEP-8 standard,它推荐 4 个空格。

为什么会这样?如何在 Colab 中更改此设置?

可以通过设置改成4个空格:

Tools > Settings > Editor > Indentation width in spaces > Select 4