How to fix Python indentation

前端 未结 13 1458
梦毁少年i
梦毁少年i 2020-11-22 08:17

I have some Python code that have inconsistent indentation. There is a lot of mixture of tabs and spaces to make the matter even worse, and even space indentation is not pre

13条回答
  •  执笔经年
    2020-11-22 08:48

    On most UNIX-like systems, you can also run:

    expand -t4 oldfilename.py > newfilename.py
    

    from the command line, changing the number if you want to replace tabs with a number of spaces other than 4. You can easily write a shell script to do this with a bunch of files at once, retaining the original file names.

提交回复
热议问题