StringIO:
提供类文件接口的字符串缓冲区,可选用性能更好的cStringIO版本:
http://docs.python.org/2.7/library/stringio.html#module-cStringIO
struct
http://docs.python.org/2.7/library/struct.html#module-struct
struct看上去有点像format,区别是它输出的是二进制字节序列。可以通过格式化参数,指定类型、长度、字节序(大小端)、内存对齐等