A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/096498.html below:

Python version of binascii.b2a_hex (binary to hex conversion)?

Python version of binascii.b2a_hex (binary to hex conversion)? Python version of binascii.b2a_hex (binary to hex conversion)?Graham Guttocks graham_guttocks at yahoo.co.nz
Fri Apr 27 15:17:19 EDT 2001
Greetings,

I need to support Python < 2.0 with one of my apps that uses
binascii.b2a_hex and binascii.a2b_hex to convert between binary data
and it's hexadecimal representation.  Since these functions aren't
available in earlier Python versions, I need to implement them myself.

For binary --> hex, I've found the following in the list archives:

  def hexlify(b):
      return "%02x"*len(b) % tuple(map(ord, b))

I couldn't find the reverse (hexadecimal string --> binary data).
Does anyone have such a function handy?

Regards,
Graham

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/


More information about the Python-list mailing list

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