Code Fix

初級TabError: inconsistent use of tabs and spaces の原因と直し方 › パターン3

TabError: inconsistent use of tabs and spaces の原因と直し方

同じブロックの中でタブとスペースを混在させたときに出るエラーです。

 1  for i in range(3):
 2      j = i
 3  ____print(j)
      ^
File "main.py", line 3 print(j) TabError: inconsistent use of tabs and spaces in indentation

空欄を埋めて実行を通す

広告
広告スロット(未設定)

TabError: inconsistent use of tabs and spaces の原因と直し方

エディタ上では同じ見た目になるため、コードを読むだけでは原因に気づけません。

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)