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

Python 3.4 - Caesar Cipher

UML - Use Case Diagram