初級 › 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
空欄を埋めて実行を通す
見た目では気づきにくいバグの代表です。多くのエディタはタブとスペースを同じ幅で表示するため、目視での発見はほぼ不可能です。
次の問題