how to pack and unpack data using python 2.5 -
i know there mutliple questions relating question i'm having difficulty understating how pack & unpack works.
for example using struct.pack("!b",14)
gives me value of x0e
one-byte binary.
how can create four-byte binary? example struct.pack("!b",104277)
should generate 0x00019755
cannot code struct.pack("!b",104277)
output 0x00019755
background details of problem
i'm trying create "type-4 high-resolution grayscale fingerprint image" record part of nist standard. first value of type-4 record length of record (len) in case 104277 bits, standard specifies len should represented four-byte binary. sample data have contains value 0x00019755
has been converted four-byte binary complies standard.
reference links:
as specified in §7.3.2.2. format characters of python manual, format code unsigned 4-byte long l
.
struct.pack("!l", 104277)
Comments
Post a Comment