What to do with “Unexpected indent” in python?

前端 未结 17 2565
天涯浪人
天涯浪人 2020-11-22 07:46

How do I rectify the error \"unexpected indent\" in python?

17条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 08:22

    If you're writing Python using Sublime and getting indentation errors,

    view -> indentation -> convert indentation to spaces

    The issue I'm describing is caused by the Sublime text editor. The same issue could be caused by other editors as well. Essentially, the issue has to do with Python wanting to treat indentations in terms of spaces versus various editors coding the indentations in terms of tabs.

提交回复
热议问题