Skip to content
← Back to Community
How to reformat and indent Python code
Profile icon
h
has Hacker Plan
PaoloAmoroso

In a Python REPL, suppose I edit some code in a file and break the canonical indentation. Is there an editor command to reformat and indent the code? I've the command palette but haven't found anything relevant.

Voters
Profile icon
TobysACodingGod
Profile icon
EdwardZervigon
Profile icon
PaoloAmoroso
Comments
hotnewtop
Profile icon
[deleted]

It can be tricky. You could try copying and pasting your code into an online formatter. E.g. https://www.tutorialspoint.com/online_python_formatter.htm

Profile icon
PaoloAmoroso

@malvoliothegood So it looks like Repl.it doesn't provide a reformat option. Thanks anyway.