Byte oriented data types in python

skip at pobox.com skip at pobox.com
Sat Jan 24 20:55:13 CET 2009


    Ravi> packet_type (1 byte unsigned) || packet_length (1 byte unsigned) ||
    Ravi> packet_data(variable)

    Ravi> How to construct these using python data types, as int and float have
    Ravi> no limits and their sizes are not well defined.

Take a look at the struct and ctypes modules.

-- 
Skip Montanaro - skip at pobox.com - http://smontanaro.dyndns.org/



More information about the Python-list mailing list