-3
我收到msg: 程序中有錯誤:預計在第4行打印數據時會出現縮進塊 。Python中的縮進塊
class listener(StreamListener):
def on_data(self, data):
try:
print data
saveFile = open('UkmDB','a')
saveFile.write(data)
saveFile.write('\n')
saveFile.close()
return True
except BaseException, e:
print 'failed ondata,',str(e)
time.sleep(5)
需要後'試圖縮進:'和'expect'必須在同一水平 – schwobaseggl
你壓痕肯定是錯誤的在這篇文章中。您是否混合了製表符和空格,並將製表符配置爲可能擴展到每個第4列?不要這樣做,只能使用空格進行縮進。 –
可能的重複[爲什麼我會得到「IndentationError:預計一個縮進塊」?](http://stackoverflow.com/questions/4446366/why-am-i-getting-indentationerror-expected-an-indented-block) –