初級 › TabError: inconsistent use of tabs and spaces の原因と直し方 › パターン5
TabError: inconsistent use of tabs and spaces の原因と直し方
同じブロックの中でタブとスペースを混在させたときに出るエラーです。
1 n = 5 2 if n > 0: 3 result = "positive" 4 ____print(result) ^
File "main.py", line 4
print(result)
TabError: inconsistent use of tabs and spaces in indentation
空欄を埋めて実行を通す
if文の本体でも同じことが起きます。前の行がスペース、次の行がタブだと字下げの深さを一意に決められません。
次の問題