How to check whether a system is big endian or little endian?
In Python:
from sys import byteorder
print(byteorder)
# will print 'little' if little endian
In C, C++
int n = 1;
// little endian if true
if(*(char *)&n == 1) {...}
See also: Perl version