Fastest way to convert a byte of integer into a list

Alan Isaac aisaac at american.edu
Thu Jul 12 20:44:02 EDT 2007


> On Jul 13, 9:54 am, Matimus <mccre... at gmail.com> wrote:
>>num = 255
>>numlist = [num >> i & 1 for i in range(8)]
 

Godzilla wrote:
> Thanks matimus! I will look into it...
 

Watch out for the order, which might
or might not match your intent.

Cheers,
Alan Isaac



More information about the Python-list mailing list