Tab Error in Python

前端 未结 4 627
故里飘歌
故里飘歌 2020-12-07 05:01

The following python code throws this error message, and I can\'t tell why, my tabs seem to be in line:

File \"test.py\", line 12
    pass
       ^ TabError         


        
4条回答
  •  Happy的楠姐
    2020-12-07 05:59

    Using Visual Studio 2019

    I was using tabs but the editor was inserting spaces and it would result in errors.

    To avoid getting the spaces and tabs mixed up , set your preferences

    Go to Edit->Advanced->Set Leading Whitespace->Tabs (or Whitespaces)

    After I set it to Tabs, my tabs stop being represented as spaces and it worked fine thereafter

提交回复
热议问题