<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>taiseiue</author_name>
  <author_url>https://blog.hatena.ne.jp/taiseiue/</author_url>
  <blog_title>taiseiueの日記</blog_title>
  <blog_url>https://d.taiseiue.jp/</blog_url>
  <categories>
    <anon>技術</anon>
  </categories>
  <description>M5StackでBLE通信をしようとMicroPythonを書いてたところ気付いたのでメモ。 str型みたいにインデックスアクセスすると、長さ1のbytesが返ってくると思ったらintが返ってきた。 text = &quot;Hello&quot; data = text.encode() print(type(text)) # 当然str print(type(data)) # もちろんbytes print(type(text[0])) # &lt;class 'str'&gt; print(type(data[0])) # &lt;class 'int'&gt; そういえばPythonは多倍長整数でもint型になるし、整数-&gt;in…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fd.taiseiue.jp%2Fentry%2F2025%2F08%2F20%2F010501&quot; title=&quot;Pythonのbytes型に対するインデックスアクセスはintを返す - taiseiueの日記&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-08-20 01:05:01</published>
  <title>Pythonのbytes型に対するインデックスアクセスはintを返す</title>
  <type>rich</type>
  <url>https://d.taiseiue.jp/entry/2025/08/20/010501</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
