Snippets has posted 5883 posts at DZone. View Full User Profile
from struct import unpack
f = open('data.bin', 'rb')
b = f.read(1)
b2 = f.read(2)
b4 = f.read(4)
n = ord(b) # from char to int
n4 = unpack('>L', b4) # big endian
n4 = unpack('<L', b4) # little endian
n = unpack('>h', b2) # big endian short
Discover best practices and the most useful tools for building the ideal integration architecture.
DZone's 170th Refcard is an essential reference to Camel, an open-source, lightweight, integration library. This Refcard is authored by...