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?
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.
Control + M M will convert a code cell to a text cell. Control + M Y will convert a text cell to a code cell.
you can change it to 4 white-spaces
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With