【问题标题】:How to indent my python code using shell command [duplicate]如何使用shell命令缩进我的python代码[重复]
【发布时间】:2021-08-23 17:28:18
【问题描述】:

我在 python 中为其他一些活动编写了几行代码,但是当我运行 python 脚本时,我总是得到indentation errorTabError : inconsistent use of tabs and spaces in indentation

有没有办法使用 Unix 命令来解决这个问题 没有安装任何IDEPycharm

以下错误:

TabError: 缩进中制表符和空格的使用不一致

【问题讨论】:

标签: python python-3.x shell


【解决方案1】:

expand 实用程序将制表符替换为空格。但是您确实希望将编辑器配置为仅使用空格来缩进 Python 代码。

【讨论】:

  • 不过,如果您已经将两者混合使用,则简单地用空格替换制表符可能不起作用。
猜你喜欢
  • 2012-01-15
  • 2020-08-21
  • 2018-08-13
  • 2020-01-20
  • 1970-01-01
  • 2018-04-05
  • 1970-01-01
  • 2013-05-04
  • 2013-07-05
相关资源
最近更新 更多