正在学习twisted,在网上找了范例代码,但是reactor.callWhenRunning(hello),reactor.run()下面都有红线,点击叉叉看到提示Undefined variable from import:callWhenRunning。可是点击运行可以正常输出结果,好晕呢呐

—————

from twisted.internet import reactor

def hello():
print ‘Hello from the reactor loop!’
print ‘Lately I feel like Im stuck in a rut.’
reactor.callWhenRunning(hello)
print ‘Starting the reactor.’

—————-

reactor.run()

2 收藏


直接登录
最新评论