有一些開源的代碼或者自己的代碼風(fēng)格不統(tǒng)一贼陶,這里簡(jiǎn)單介紹一下,如何eclispe的pydev進(jìn)行格式化代碼:
1. 設(shè)置python的編碼風(fēng)格
windows --> Preferences --> PyDev --> Editor -->Code Style --> Code Formatter --> Formatter Style? -- >autopep8(勾選)
2. 設(shè)置保存文件時(shí),自動(dòng)格式化
windows --> Preferences --> PyDev --> Editor --> Save Actions --> Auto-format editor contents before saving? (勾選)