Write a Python program to test whether the system is a big-endian platform or a little-endian platform.

Write a Python program to test whether the system is a big-endian platform or a little-endian platform.

1
2
3
4
5
6
7
8
9
import sys
print()
if sys.byteorder == "little":
    #intel, alpha
    print("Little-endian platform.")
else:
    #motorola, sparc
    print("Big-endian platform.")
print()

Final output

Leave a Comment