Python Indentation errors when changing block structure of program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Python Indentation errors when changing block structure of program

what is the best or easiest way to indentation correct when you want to imbed a preexisting block of code in a try except exception handler??? I have a lot of trouble getting indentation correct when I do this.

4th Aug 2018, 5:11 PM
Rick Shiffman
Rick Shiffman - avatar
2 Answers
+ 1
One option is to use an editor with auto indentation function. Another will be using some python library like the built in Tabnanny https://docs.python.org/3/library/tabnanny.html
4th Aug 2018, 5:24 PM
Qwertiony
Qwertiony - avatar
+ 2
I've found that the code editor in IDLE has block indent and dedent abilitys and solves my problem of moving blocks of code around in python and getting the indentation correct
2nd Sep 2018, 11:05 PM
Rick Shiffman
Rick Shiffman - avatar