from twisted.internet import reactor这里reactor默认为 selectreactor react
若要选择其余类型的reactor则 oop
from twisted.internet import pollreactor import
pollreactor.install() select
咱们得用Twisted来作什么吧。下面这段代码在reactor循环开始后向终端打印一条消息: 循环
def hello(): 终端
print 'Hello from the reactor loop!' im
print 'Lately I feel like I\'m stuck in a rut.' call
from twisted.internet import reactor loop
reactor.callWhenRunning(hello) 消息
print 'Starting the reactor.'
reactor.run()