BCD List to HEX List

Philippe Martin pmartin at snakecard.com
Sun Jul 30 23:43:00 EDT 2006


Dennis Lee Bieber wrote:

> On Sun, 30 Jul 2006 17:07:57 -0500, Philippe Martin
> <pmartin at snakecard.com> declaimed the following in comp.lang.python:
> 
>> Paul Rubin wrote:
>> 
>> > 
>> > If you prefer, You can do it all in one line:
>> > 
>> >    vlist = [int(d, 16) for d in ('%X' % int(''.join(map(str, l1))))]
>> 
>> Thanks Paul,
>> 
>> I'm just using Python to prototype, so I cannot use any of these great
>> features of the language.
>>
> 
> You asked for "algorithm"... The above can be translated to C fairly
> easily without changing the algorithm... The array handling requires
> some thought, but...
> 
> Or did you want a literal "recipe"
> 
> for each integer in list I1:
> convert to string representation
> join the resultant strings into one string
> convert result to binary integer
> "print" the integer to string using Hex format code
> for each hex-digit in the string representation:
> convert to binary representation
> 
> But then, that description was given to you... <G>
> 
> That /is/ the algorithm... Implementation is a detail for the
> student <G>
> --
> Wulfraed      Dennis Lee Bieber               KD6MOG
> wlfraed at ix.netcom.com         wulfraed at bestiaria.com
> HTTP://wlfraed.home.netcom.com/
> (Bestiaria Support Staff:             web-asst at bestiaria.com)
> HTTP://www.bestiaria.com/


Thank you very much 





More information about the Python-list mailing list