A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20080809/5e34472f/attachment.htm below:

<div dir="ltr">Hi,<br><br>I&#39;m confused as to how you represent a bytes object in hexadecimal in Python 3. Of course in Python 2, you use str.encode(&#39;hex&#39;) to go to hex, and hexstr.decode(&#39;hex&#39;) to go from hex.<br>
<br>In Python 3, they removed &quot;hex&quot; as a codec (which was a good move, I think). Now there&#39;s the static method bytes.fromhex(hexbytes) to go from hex. But I haven&#39;t figured out any (easy) way to convert a byte string to hex. Is there some way I haven&#39;t noticed, or is this an oversight?<br>
<br>The easiest thing I can think of currently is this:<br>&#39;&#39;.join(hex(b)[2:] for b in mybytes)<br><br>I think there should be a bytes.tohex() method. I&#39;ll add this as a bug report if it indeed is an oversight, but I thought I&#39;d check here first to make sure I&#39;m not just missing something.<br>
<br>Matt<br></div>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4