python
# 整数読み込み
num = 9240
# 16進変換(0x除く)
num_hex = hex(num)[2:]
# 16進→バイト変換
bytes_be = bytes.fromhex(num_hex)
# エンディアン変換
bytes_le = bytes_be[::-1]
hex_le = bytes_le.hex()
print(hex_le) # "1824"
Go to list of users who liked
More than 3 years have passed since last update.
# 整数読み込み
num = 9240
# 16進変換(0x除く)
num_hex = hex(num)[2:]
# 16進→バイト変換
bytes_be = bytes.fromhex(num_hex)
# エンディアン変換
bytes_le = bytes_be[::-1]
hex_le = bytes_le.hex()
print(hex_le) # "1824"
Register as a new user and use Qiita more conveniently
Go to list of users who liked