Is this a bug of module struct?

2006-08-25 Thread rong . xian
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\x0

Re: Is this a bug of module struct?

2006-08-25 Thread rong . xian
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\x000123456