I don't know of a way to directly access the internal structure of a
long, but you can speed up your example.

First, is the order of the commands

>   i=i>>1
>   lstBitsBitwiseAnd.append(i&0x01)

what you intend? The first low order bit is discarded because you've
done the shift first. And an extra 0 is appended.

If you are trying to get the binary representation of a long, try
i.__hex__(). This will create a string with the hex representation.
Conversion from hex to binary is left as an exercise for the reader. :-)

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to