dtype.byteorder¶A character indicating the byte-order of this data-type object.
One of:
| ‘=’ | native |
| ‘<’ | little-endian |
| ‘>’ | big-endian |
| ‘|’ | not applicable |
All built-in data-type objects have byteorder either ‘=’ or ‘|’.
Examples
>>>dt=np.dtype('i2')>>>dt.byteorder'='>>># endian is not relevant for 8 bit numbers>>>np.dtype('i1').byteorder'|'>>># or ASCII strings>>>np.dtype('S2').byteorder'|'>>># Even if specific code is given, and it is native>>># '=' is the byteorder>>>importsys>>>sys_is_le=sys.byteorder=='little'>>>native_code=sys_is_leand'<'or'>'>>>swapped_code=sys_is_leand'>'or'<'>>>dt=np.dtype(native_code+'i2')>>>dt.byteorder'='>>># Swapped code shows up as itself>>>dt=np.dtype(swapped_code+'i2')>>>dt.byteorder==swapped_codeTrue