Q:

How do you do bit operation in Python?

Possible Duplicate:
How do I manipulate bits in Python? 

Here is my code:
int val = 0xAA;
int Bit, i;

for (i = 0; i < sizeof(Val)*8; i++) {
    Bit = 1<<i;    
    if (Val & Bit) {
        printf("Found a bit \n");
    }
}

I am a C person and I need to do this in Python. Can anyone help?

A:

According to the documentation, you do them the same way you could in C:
5.4.1 Bitwise Operations on Integer Types

