Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.dtype.byteorder

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

Previous topic

numpy.dtype.itemsize

Next topic

numpy.dtype.flags

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp