Python 3.4 - Struct

Data sometimes needs to be unpacked, packed, convert, transferred, etc. The packing function form the struct module achieves this action.

from struct import *

packed_data = pack('iif', 3, 44, 4.5)

print(packed_data)

print(calcsize('i'))
print(calcsize('f'))
print(calcsize('iif'))

original_data =unpack('iif', packed_data)

print(original_data)



https://www.youtube.com/watch?v=PGAtCGqt06U

Comments

Popular posts from this blog

New Ways of Conversing: The Kindle 2 and what I think it means

Huddled Masses Yearning: Teach the Controversy

Conversations Ongoing: A Bunch of Amateurs