Python: Test whether the system is a big-endian platform or little-endian platform
Python Basic: Exercise-77 with Solution
Write a Python program to test whether the system is a big-endian platform or little-endian platform.
Sample Solution:-
import sys
print()
print(sys.byteorder)
if sys.byteorder == "little":
#intel, alpha
print("Little-endian platform.")
else:
#motorola, sparc
print("Big-endian platform.")
print()
=========== RESTART: F:/Python_APSC/py-ex-basic-77.py =============
little
Little-endian platform.
>>>
沒有留言:
張貼留言