Alan Franzoni wrote:
Michael Torrie was kind enough to say:

Of course any time you send coherent numbers over the network, I highly
recommend you use what's called network byte order....  I'm sure python
has some convention in the struct module for dealing with this.

Not in the struct module; such functions are available in the socket
module, and should be employed indeed.
Please don't pass this misinformation along.

In the struct module document, see the section on the initial character:
    Character Byte order Size and alignment
      @          native            native
      =          native           standard
      <       little-endian       standard
      >        big-endian         standard
      !    network (= big-endian) standard
  and notes @ is the default.
>>> print struct.pack('<lh', 3,4)
>>> print struct.pack('>lh', 3,4)
>>> print struct.pack('lh', 3,4)
>>> print struct.pack('!lh', 3,4)

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to