def read(): ''' test read object from bianry file ''' bin_file = open("E:/workspace-sts-3.6.1.RELEASE/JavaDemo/1.dat", "rb", 1024) bean_pair = Pair() trans = TTransport.TFileObjectTransport(bin_file) ibp = TBinaryProtocol.TBinaryProtocol(trans) bean_pair.read(ibp) print bean_pair.key