<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>shuzo_kino</author_name>
  <author_url>https://blog.hatena.ne.jp/shuzo_kino/</author_url>
  <blog_title>Bye Bye Moore</blog_title>
  <blog_url>https://shuzo-kino.hateblo.jp/</blog_url>
  <categories>
    <anon>python</anon>
  </categories>
  <description>Pythonで文字列整形といえば……formatですね。 こいつをつかえば、ビット芸もこの通り。 &quot;{:04X}{:04X}{:04X}{:04X}&quot;.format(0xde,0xad,0xbe,0xef) #&gt;&gt;'00DE00AD00BE00EF' とはいえ、諸般の都合でbyte型じゃないと困るケースもあるでしょう。 シリアル通信に使う時とか。 その場合はencode関数を使うだけでOKです。 &quot;{:04X}{:04X}{:04X}{:04X}&quot;.format(0xde,0xad,0xbe,0xef).encode() #&gt;&gt; b'00DE00AD00BE00EF' 参考もと 6.1. st…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fshuzo-kino.hateblo.jp%2Fentry%2F2016%2F11%2F04%2F225924&quot; title=&quot;encode関数を使って、String型をBytes型に変更する - Bye Bye Moore&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>2016-11-04 22:59:24</published>
  <title>encode関数を使って、String型をBytes型に変更する</title>
  <type>rich</type>
  <url>https://shuzo-kino.hateblo.jp/entry/2016/11/04/225924</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
