Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change indentation level in Google Colab

I am using Google Colaboratory to write Python code in their notebook. Whenever I hit an enter after a for loop definition or in a try-except block, the new line is automatically indented, which is good, but it uses only 2 whitespaces by default. This is contrary to PEP-8 standard.

Why is this the case and how can I change this setting?

like image 256
zabop Avatar asked Mar 03 '19 16:03

zabop


People also ask

How do I fix indentation error in Google Colab?

Here's how I fixed it. Before pasting the copied code into Colab, first put it into notepad++. Go to View> Show Symbols >Show All Characters, click on this, you should now be able so see all the characters in the code.

What is Ctrl M in Colab?

Control + M M will convert a code cell to a text cell. Control + M Y will convert a text cell to a code cell.


1 Answers

you can change it to 4 white-spacesenter image description here

like image 180
Mohammed Awney Avatar answered Sep 28 '22 02:09

Mohammed Awney