初級 › TabError: inconsistent use of tabs and spaces の原因と直し方 › パターン1
TabError: inconsistent use of tabs and spaces の原因と直し方
同じブロックの中でタブとスペースを混在させたときに出るエラーです。
1 def f(): 2 x = 1 3 ____print(x) ^
File "main.py", line 3
print(x)
TabError: inconsistent use of tabs and spaces in indentation
空欄を埋めて実行を通す
同じブロックの中でタブとスペースを混ぜると、Pythonは字下げの深さを一意に決められません。1つのファイルではどちらかに統一します。
次の問題