K
K
Kirill Kochurov2020-07-01 14:56:23
Python
Kirill Kochurov, 2020-07-01 14:56:23

How to fix Python TabError: inconsistent use of tabs and spaces in indentation error?

import pyautogui as auto
import keyboard as key

print("What mouse button do you want autoclicker 1 - Left 2 - Right write below!")
ttb = input("Enter a number: ")

if ttb == "1":
start_key = input( "Start key: ")
stop_key = input('Stop key: ')

while True:
if key.is_pressed( start_key ):
auto.tripleClick()

if key.is_pressed( stop_key ):
break

elif ttb == "2":
start_key = input("Start key: ")

stop_key = input('Stop key: ')

while True:
if key.is_pressed( start_key ):
auto.tripleClick( button = 'right')

if key.is_pressed( stoop_key ):
break

here is the code, why does it write an error?
TabError: inconsistent use of tabs and spaces in indentation

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Karbivnichy, 2020-07-01
@kirill_kochurov

Both spaces and tabs are used as indents. I think this question should be banned for life!

S
Saraman, 2020-07-01
@Saraman

Replace all indents with either only spaces or only tabs.

L
lolchik, 2020-07-01
@lo1chik

Try next time to add water as spaces and milk as tabs to the cereal. Your stomach will tell you in a passive-aggressive form that you don’t need to mix things that seem to be similar, but they don’t. Also, the python doesn’t really want to eat a mess of two immiscible indentation methods, which, by the way, are generally absent in the example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question