[Python-Dev] Readability of hex strings (Was: Use of coding cookie in 3.x stdlib)

Georg Brandl g.brandl at gmx.net
Mon Jul 26 22:42:51 CEST 2010


Am 26.07.2010 20:42, schrieb Alexandre Vassalotti:
> [+Python-ideas -Python-Dev]
> 
> import binascii
> def h(s):
>   return binascii.unhexlify("".join(s.split()))
> 
> h("DE AD BE EF CA FE BA BE")

In Py3k:

h = bytes.fromhex

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-Dev mailing list