本文使用PyCharm的格式化代碼功能解決TabError: inconsistent use of tabs and spaces in indentation。
當把代碼從別處復制進來PyCharm,然后運行報錯:TabError: inconsistent use of tabs and spaces in indentation

這個報錯的意思是說IDE分不清tab和空格,說明你的代碼中混用了tab和空格。
傳統的方式是找出代碼中報錯的地方,然后修改。
這種方法可以,但是我試的並不好用。我推薦一種解決方法:格式化代碼!
具體操作是:Code -->Reformat Code

再次嘗試運行,問題完美解決!
