更改 Google Colab 中的缩进级别

问题描述 投票:0回答:2

我正在使用 Google Colab 在他们的笔记本中编写 Python 代码。每当我在循环或条件后点击

enter
时,新行就会自动缩进,这很好,但默认情况下它只使用 2 个空格。这违反了 PEP-8 标准,该标准建议使用 4 个空格。

为什么会出现这种情况以及如何在 Colab 中更改此设置?

python google-colaboratory indentation pep8
2个回答
58
投票

可以通过设置将其更改为4个空格:

Tools
>
Settings
>
Editor
>
Indentation width in spaces
> 选择
4


0
投票

这就是我所做的

Settings
/
Editor
/
Indentation width in spaces
/
4
/
Save

© www.soinside.com 2019 - 2024. All rights reserved.