1、pycharm已经为我们开发了一个快速规整程序格式的入口,快捷键为‘Ctrl + Alt + L’。
2、如果不用快捷键的话,可以点击上面的Code -> Reformat Code,然后就搞定了。