首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

如何看twistedapi的有关问题

2014-01-08 
怎么看twistedapi的问题刚学python,想问下twisted文档里边为什么没类属性条目呢,比如BaseProtocol里边有co

怎么看twistedapi的问题
刚学python,想问下twisted文档里边为什么没类属性条目呢,比如BaseProtocol里边有connected,和transport属性,API文档里哪有说明啊,
from twisted.internet.protocol import Protocol
class Echo(Protocol):
def dataReceived(self, data):
self.transport.write(data)

我该怎么知道self能调用transport,transport里边还有write呢,刚学,能不能具体给我API文档里边找的步骤说明一下啊 python twisted
[解决办法]
摘自BaseProtocol的文档(http://twistedmatrix.com/documents/11.0.0/api/twisted.internet.protocol.BaseProtocol.html):

My API is quite simple. Implement dataReceived(data) to handle both event-based and synchronous input; output can be sent through the 'transport' attribute, which is to be an instance that implements twisted.internet.interfaces.ITransport.

热点排行