Search code examples
pythonautomationeditindentation

How to convert indentation from 2 spaces to 4 spaces


Possible Duplicate:
HOWTO: Fix Python Indentation

I have Python library where only 2 spaces indentation was used. I need automated way to convert all files to 4 spaces indentation. Is there any tool/script/editor for that?

Plz don't suggest Emacs.


Solution

  • Try the reindent script by Tim Peters, it was designed specifically for converting Python files to 4-space indentation.

    For users with Python 3.9 or newer consider using reindent latest version.