Python 扭曲的问题
Python twisted issue
我在将我的扭曲脚本运行到 运行 时遇到问题,它在第 13 行
抛出语法错误
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/
所以我认为错误不是由于缩进造成的。感谢阅读!
如果这是您的实际缩进,那么您的缩进是关闭的。
您的陈述不在函数的范围内。
我在将我的扭曲脚本运行到 运行 时遇到问题,它在第 13 行
抛出语法错误 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/
所以我认为错误不是由于缩进造成的。感谢阅读!
如果这是您的实际缩进,那么您的缩进是关闭的。
您的陈述不在函数的范围内。