0

In http://docs.python.org/library/struct.html, it says "<" represents little-endian mode in standard size. I checked on this website and it says the standard size is 16 bits.

WHY 16 BITS?

Is there anyway to change it to 8-bit and still using the little-endian?

Best regards!

question is still OPEN!

I know LSB or MSB describe the data organization based on bytes. The questions is the standard size is 16-bit, so python read the data based on the standard size then based on the LSB or MSB. If I use

And, if the standard size is 16-bit long, then why if I use ">h", it actually give the correct answer as the standard size is 8-bit?

1 Answer 1

2

Big endian and little endian aren't really meaningful for a byte. Endianness describes the order of bytes in a multi-byte type.

That said, you can use "<B" as your type. That gives you little-endian 8 bits.

Sign up to request clarification or add additional context in comments.

4 Comments

Then use a 32-bit type like L.
stackoverflow.com/questions/12163549/… this is the other thread I posted. Please help if you may.
I know LSB or MSB describe the data organization based on bytes. The questions is the standard size is 16-bit, so python read the data based on the standard size then based on the LSB or MSB. If I use <L, it actually read the lower 16 bits first then the upper 16 bits. However, I need to read the last 8 bits first, then read every 8-bit forward in LSB mode, to finally get a long/int data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.