Binary format in Python


I’ve been wondering.. how many bits Python needs for representing an integer number? Unlike C, which has strong types of variable, Python has weak variable typing mechanism. In C, for instance, uint16_t means an integer number which has exactly 16 bits. But, how does Python do it? Hence, after I ‘googled’ a little, I found a documentation about structs module in Python.

“This module performs conversions between Python values and C structs represented as Python strings. This can be used in handling binary data stored in files or from network connections, among other sources. It uses Format Strings as compact descriptions of the layout of the C structs and the intended conversion to/from Python values.”

That’s all,


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s