I got it, alignment issue...
> >>> struct.pack('!3I14sI',1,19960101,14,'0123456789abcd',6)
> '\x01\x00\x00\x00%\x910\x01\x0e\x00\x00\x000123456789abcd\x06\x00\x00\x00'
> >>> struct.pack('!3I14s',1,19960101,14,'0123456789abcd')+struct.pack('!I',6)
> '\x01\x00\x00\x00%\x910\x01\x0e\x00\x00\x000123456789abcd\x06\x00\x00\x00'

[EMAIL PROTECTED] wrote:
> Before I was bitten by the difference below, I think these two ways are
> the same.
> However, they are not.
> Is there any geek who can tell me if this is a bug?
> (some weird '\x00\x00' was inserted between '0123456789abcd' and 6 )
>
>
> >>> struct.pack('3I14sI',1,19960101,14,'0123456789abcd',6)
> '\x01\x00\x00\x00%\x910\x01\x0e\x00\x00\x000123456789abcd\x00\x00\x06\x00\x00\x00'
> >>> struct.pack('3I14s',1,19960101,14,'0123456789abcd')+struct.pack('I',6)
> '\x01\x00\x00\x00%\x910\x01\x0e\x00\x00\x000123456789abcd\x06\x00\x00\x00'

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

Reply via email to