Reindent a source file
You have a source file that you want to work with but it mixes tabs and spaces. The interpreter eats the file but it’s a nightmare to work with. How to correct it?
Fortunately, the standard installation comes with a handy utility called “
reindent.py“. You can find it with “
It will make a backup (
bad.py.bak) of the original file and overwrite
bad.py. The new
bad.py will be indented correctly with 4 spaces everywhere.
If you don’t find
reindent.py, it is located here:
You might have to install the package “python-examples” to have it.