[Tutor] ASCII hex to binary

Terry Carroll carroll@tjc.com
Mon Aug 4 22:16:01 EDT 2003


On Mon, 4 Aug 2003, Zak Arntson wrote:

> hex_to_bin = lambda s: ''.join(map(lambda c: [''.join(['01'[2**j & k > 0]
> for k in range(16) for j in range(3, -1, -1)][i:i+4]) for i in range(0,
> 256, 4)][int(c, 16)], s))

This almost makes me nostalgic for Perl.

-- 
Terry Carroll        |   "I say to you that the VCR is to the American
Santa Clara, CA      |   film producer and the American public as the 
carroll@tjc.com      |   Boston strangler is to the woman home alone."  
                     |       Jack Valenti, MPAA President
Modell delendus est  |       Testimony before Congress, 1982





More information about the Tutor mailing list