struct -- Interpret strings as packed binary data
This module performs conversions between Python values and C structs represented as Python strings. It usesformat strings (explained below) as compact descriptions of the lay-out of the C structs and the intended conversion to/from Python values. This can be used in handling binary data stored in files or from network connections, among other sources.
chr(i)
Return a string of one character whose ASCII code is the integer i. For example,chr(97) returns the string 'a'. This is the inverse of ord(). The argument must be in the range [0..255], inclusive; ValueError will be raised if i is outside that range.
>>> import struct, socket
>>> struct.unpack('BBBB', socket.inet_aton('1.2.3.4'))
(1, 2, 3, 4)
>>>