自动修复python缩进错误 [英] auto-fix python indentation error
本文介绍了自动修复python缩进错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
方法:修复Python缩进
我有一些代码是从旧代码中复制粘贴的,因此缩进现在是完全错误的,编译器会出错.
I have some code that is copy-pasted from older code, so the indentation is completely wrong now, and compiler gives errors.
有没有一种方法可以自动修复缩进(不只是将制表符换成空格)?我在Eclipse中使用 Ctrl + Shift + F 尝试了pyDev 2.7(声称具有自动格式化功能),但它没有任何改变
Is there a way to automatically fix the indentation (not just swapping tabs with spaces)? I tried pyDev 2.7 (which claims to have auto-format) in Eclipse using Ctrl+Shift+F, but it didn't change anything.
推荐答案
使用缩进
http://pypi.python.org/pypi/Reindent/0.1.0
pip install reindent
reindent <file>
您还可以查看PythonTiddy
You can also look at PythonTiddy
这篇关于自动修复python缩进错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文