Nov-27-2018, 08:40 PM
if __name__ == "__main__": tuppleCounter = [ 0, 0, 0 ,0 ] with open('myfile', 'rb') as fl: b = fl.read( 1 ) for x in range( 0,4): tuppleCounter[ ( ( 3 << ( x * 2 ) ) & b ) >> ( x*2 ) ]+=1 print tuppleCounter;
nextor@leon:~/Projects/tmp/pypress$ python test.py
Traceback (most recent call last):
File "test.py", line 10, in <module>
tuppleCounter[ ( ( 3 << ( x * 2 ) ) & b ) >> ( x*2 ) ]+=1
TypeError: unsupported operand type(s) for &: 'int' and 'str'
nextor@leon:~/Projects/tmp/pypress$