biner wrote:
>   I would like to have a test to tell me if the current machine is
> using big or small endian, this way I could use the array module in
> the first case and the *slower* struct module on the second. I looked
> but did not find. Is there a python function to know that?
>
> Thanks!

How about sys.byteorder?

At least if you are using array.array, note the "byteswap" method:

    >>> import array
    >>> v = array.array('h',range(8))
    >>> v
    array('h', [0, 1, 2, 3, 4, 5, 6, 7])
    >>> v.byteswap()
    >>> v
    array('h', [0, 256, 512, 768, 1024, 1280, 1536, 1792])

--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to