<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>potisan</author_name>
  <author_url>https://blog.hatena.ne.jp/potisan/</author_url>
  <blog_title>potisanのプログラミングメモ</blog_title>
  <blog_url>https://potisan-programming-memo.hatenablog.jp/</blog_url>
  <categories>
    <anon>Python 3</anon>
  </categories>
  <description>バイト配列（バイナリデータ）を整数に変換するにはint.from_bytesクラスメソッドを使用します。一見単純ですが、エンディアンや符号の設定に注意が必要です。 エンディアン 以下のコードはタプルから整数を作成して16進数で出力します。タプルはbytearray関数やbytes関数、bytesリテラル（b&quot;0x81...&quot;）、リストでも置き換えられます。hex関数はf-文字列 (f&quot;0x{i:X}&quot;)で置き換えられますが、以下で説明する符号の扱いを考えるとhex関数の方が扱いやすいかもしれません。 i = int.from_bytes((0x81, 0x23, 0x45, 0x67)) pr…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpotisan-programming-memo.hatenablog.jp%2Fentry%2F2025%2F02%2F11%2F145006&quot; title=&quot;Python3 バイト配列を整数に変換する方法 - potisanのプログラミングメモ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-02-11 14:50:06</published>
  <title>Python3 バイト配列を整数に変換する方法</title>
  <type>rich</type>
  <url>https://potisan-programming-memo.hatenablog.jp/entry/2025/02/11/145006</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
