2012年5月15日

摘要: Twisted 的 callInThread 和 callFromThread 区别这两个函数的定义在 IReactorThreads 的文档里。Method callInThread :Run the callable object in a separate thread.Method callFromThread :Cause a function to be executed by the reactor thread.Use this method when you want to run a function in the reactor's thread from ano 阅读全文
posted @ 2012-05-15 11:26 很多不懂呀。。 阅读(3761) 评论(1) 推荐(1) 编辑
摘要: 有的时候需要用python处理二进制数据,比如,存取文件,socket操作时.这时候,可以使用python的struct模块来完成.可以用 struct来处理c语言中的结构体.struct模块中最重要的三个函数是pack(), unpack(), calcsize()pack(fmt, v1, v2, ...) 按照给定的格式(fmt),把数据封装成字符串(实际上是类似于c结构体的字节流)unpack(fmt, string) 按照给定的格式(fmt)解析字节流string,返回解析出来的tuplecalcsize(fmt) 计算给定的格式(fmt)占用多少字节的内存... 阅读全文
posted @ 2012-05-15 10:15 很多不懂呀。。 阅读(6424) 评论(0) 推荐(0) 编辑

导航