Fastest way to convert a byte of integer into a list

Alan Isaac aisaac at
Fri Jul 13 02:44:02 CEST 2007

> On Jul 13, 9:54 am, Matimus <mccre... at> 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.

Alan Isaac

More information about the Python-list mailing list