0
0

More than 1 year has passed since last update.

[Python] 16進数→10進数変換(intを使用)のエンディアン調査

Last updated at Posted at 2022-10-31

目的

intを使用した16進数→10進数変換のエンディアン(バイトオーダを調査する)

確認方法

0x0110をinputに結果を確認する。

ビッグエンディアンの場合 → 0110 → 272
リアルエンディアンの場合 → 1001 → 4097

プログラム

print(int('0110', 16))

結果

272

結論

ビッグエンディアン

補足

下記でlittleエンディアンで読み込めることを確認。

print(int.from_bytes(b'\x01\x10', 'little'))

参考URL

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0