while loop == 6:
if EVENTCOUNT >= 4:
_, username, para, value = event.split(" ", 3)
try:
self.dbcur.execute('select ? from users where name = ?', [para, username])
if rrf is None:
print notex
else:
print str(username)+" has been altered: "+str(para)+" => "+str(value)+"."
while loop == 2:
again = raw_input("Is that all? (Y/N)")
while True:
if again == "Y":
# edit another parameter
loop=4
elif again == "N":
print "Thanks! Bye! \nAll credits of this program go to Trey."
#end program
break
else:
print "Sorry! That wasn't Y or N."
loop == 2
我收到错误:“IndentationError:预计会出现缩进块”,如果EVENTCOUNT> = 4下面有错误:
答案 0 :(得分:1)
使用IDE,它通常具有缩进工具,用于自动将混合制表符和空格转换为所有制表符或空格。这是你的代码,每个缩进有4个空格。
while loop == 6:
if EVENTCOUNT >= 4:
_, username, para, value = event.split(" ", 3)
try:
self.dbcur.execute('select ? from users where name = ?', [para, username])
if rrf is None:
print notex
else:
print str(username)+" has been altered: "+str(para)+" => "+str(value)+"."
while loop == 2:
again = raw_input("Is that all? (Y/N)")
while True:
if again == "Y":
# edit another parameter
loop=4
elif again == "N":
print "Thanks! Bye! \nAll credits of this program go to Trey."
#end program
break
else:
print "Sorry! That wasn't Y or N."
loop == 2
except Exception,err:
print "error"
答案 1 :(得分:0)
您必须对文件中的所有块使用一致的缩进 - 我(和PEP8)强烈建议使用四个空格。
在单个文件中混合制表符和空格很糟糕,因为制表符根据开发人员的环境具有可变的感知宽度。混合单个文件中的空格数可能会使解释器混淆。