<分区>
Possible Duplicate:
HOWTO: Fix Python Indentation
我有一些代码是从旧代码复制粘贴过来的,所以现在缩进完全错误,编译器报错。
有没有办法自动修复缩进(不仅仅是用空格交换制表符)?我在 Eclipse 中使用 Ctrl+Shift+F 尝试了 pyDev 2.7(声称具有自动格式),但它没有改变任何东西.
<分区>
Possible Duplicate:
HOWTO: Fix Python Indentation
我有一些代码是从旧代码复制粘贴过来的,所以现在缩进完全错误,编译器报错。
有没有办法自动修复缩进(不仅仅是用空格交换制表符)?我在 Eclipse 中使用 Ctrl+Shift+F 尝试了 pyDev 2.7(声称具有自动格式),但它没有改变任何东西.
最佳答案
使用重新缩进
http://pypi.python.org/pypi/Reindent/0.1.0
pip install reindent
reindent <file>
你也可以看看PythonTiddy
关于python - 自动修复 python 缩进错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13806961/
相关文章:
python - pygame : Getting rid of strange gradient effect on displayed image
python - Google Sheets API 在本地工作,但从 AWS Lambda 运行时连接超时
java - 为什么 toString() 在 Android SDK (Eclipse) 中抛出 NullPointerException?
eclipse - 如何在 Eclipse 中从 CVS 恢复以前的更新
python - 不清楚哪个 Python 版本用于远程调试 (Eclipse Pydev)