python为什么会有缩进_为什么会出现缩进错误?

我不明白为什么第一次“def run”时会出现缩进错误import threading, time, sys

class Listen:

def __init__(self):

print "Choose a direction. Forwards (1) or Backwards (2) or to quit type 'quit'"

direction = 0

def run (threadName):

while 1==1 :

print "%s Listening for direction: " %(threadName)

direction = input

time.sleep(1)

if (direction != 1 or 2):

print "You entered a incorrect value"

elif (direction=='quit'):

break

thread.exit()

else:

return direction

class Store:

def run (threadName, direction):

print "%s %s" %(threadName, direction)

if __name__ == '__main__':

l = Listen()

s = Store()

listeningThread = threading.Thread(target=l.run, args=())

storingThread = threading.Thread(target=s.run, args=())

listeningThread.start()

storingThread.start()

我要做的是在listengthread中存储一个值,同时listengthread会不断地监听新的输入来替换当前存储的值。在

但由于我是Python新手,我已经与这个错误纠结了很长一段时间了,尽管我还是可以问一下有帮助的人:)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值