0
我有一個問題讓我扭曲的腳本來運行其上線13Python的扭曲問題
File "sponzyTwisted.py", line 13
else:
^
SyntaxError: invalid syntax
這裏拋出一個語法錯誤,是因爲我使用它的代碼:
class printStuffs(object):
count = 0
def count(self):
count += 1
print "the counter is at" + count
class controlListener(object):
count = 0
def count(selt):
if self.counter == 0:
print "Killing Process"
reactor.stop()
else:
print self.counter, '...'
self.counter -= 1
reactor.callLater(1, self.count)
from twisted.internet import reactor
print "Printing random stuff"
reactor.callWhenRunning(printStuffs().count)
print "Intializing kill listner"
reactor.callWhenRunning(controlListner().count)
我從字面上切割和粘貼這裏的代碼: http://krondo.com/our-eye-beams-begin-to-twist/
所以我不認爲這個錯誤是由於縮進。謝謝閱讀!
你明白了,我必須檢查他們5次,但我又做了,它的工作? –
很高興現在正在工作。你應該重新命名一些你的變量,然後在'def count(selt)'我認爲你的意思是'def count(self)' – Pythonista
是的,我注意到剛纔有另一個錯誤哦,那就是編碼 –